# Problem with MSMTP and PHP



## k8__ (Sep 12, 2008)

Hi guys,
i using xampp and i trying to configure MSMTP with PHP to send the mail with function mail() of php.
I have a this problem, with this config: 

```
sh-3.2# ls -ls /var/empty/
total 8
8 -rw-------  1 nobody  nobody  195 12 Set 22:35 .msmtprc
0 -rwxrwxrwx  1 nobody  nobody    0 12 Set 22:35 log.log
sh-3.2# cat /var/empty/.msmtprc 
account default
logfile /var/empty/log.log
syslog off
host smtp.gmail.com
timeout 60
port 587
from someaddresshere@gmail.com
auth login
user someaddresshere@gmail.com
password *******
tls on
tls_certcheck off
```

and php.ini is:

```
sendmail_path = "/opt/local/bin/msmtp -C /var/empty/.msmtprc -t"
```

Ok,
when i try to send mail with mail() i receive this error in error_log of apache:


```
msmtp: cannot create temporary file: Permission denied
```

I do not know where I must modify the permissions and I must wants to write files temporary.

Some ideas?

p.s If i try to send mail with this command to shell bash:

```
echo "hello." | msmtp --debug --from=default -t someotheremailaddress@someotherdoma.in
```
Work correctly. 

Thanks.


----------



## k8__ (Sep 12, 2008)

Solved 

```
putenv("TMPDIR=/tmp");
```
in the script php before the calling mail()


----------



## k8__ (Oct 25, 2009)

Please delete the mail [hidden form of the email address to the script above] and [the other address in a cryptic form used in the other example above] ON The Topic Up! Thanks.


----------



## Giaguara (Oct 25, 2009)

k8__, I think you should be able to change your posts yourself.. but anyway, doing that for you now.


----------



## k8__ (Oct 25, 2009)

Many thanks Giaguara. Please delete this post and my latest post. 


I don't have the permission to delete it. 


Thanks!


----------



## Giaguara (Oct 25, 2009)

Fatto


----------

