Page 1 of 1

can't send mail to Gmail

PostPosted: 19. October 2008 12:07
by patcunha

I tried to find the answer to my problem in google but all I could find was people with this same problem.

I have a form that uses the php mail function to send an email and it works fine except when I try to send the email to a gmail or google apps account.

The server is local and the domain is the same as in the email I want to send (google apps).

What do I have to do?

This is my php.ini file concerning the mail function:

Code: Select all
[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from =

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

Why does it works with an email like <myname> and not with gmail or with a google apps account?
I'm using Postfix!

I found this but it looks to much! Do I have to do this?
My system:OpenSuse 10.3

PostPosted: 19. October 2008 12:54
by Wiedmann
I'm using Postfix!

Your Postfix logs should have more infos.

(I assume, that you dan't have any error from PHPs' mail() function)

PostPosted: 19. October 2008 15:55
by patcunha
This is an extract of the logs:
Code: Select all
Oct 14 13:00:26 esaof postfix/qmgr[3109]: 8B080F45B5: from=<>, size=3179, nrcpt=1 (queue active)
Oct 14 13:00:26 esaof postfix/local[8534]: 8B080F45B5: to=<>, relay=local, delay=0.82, delays=0.76/0.02/0/0.05, dsn=5.1.1, status=bounced (unknown user: "admin")

Oct 18 18:23:35 esaof postfix/smtp[27831]: 95E59F45B3: to=<>,[]:25, delay=11, delays=0.21/0/10/0.15, dsn=2.0.0, status=sent (250 ok 1224350615 qp 8108)

Oct 18 17:26:58 esaof postfix/qmgr[3109]: E9033F45B3: from=<>, size=1320, nrcpt=1 (queue active)
Oct 18 17:26:58 esaof postfix/local[27425]: E9033F45B3: to=<>, relay=local, delay=0.3, delays=0.22/0.02/0/0.06, dsn=5.1.1, status=bounced (unknown user: "pais")

Code: Select all
Oct 18 17:30:35 esaof postfix/smtp[27462]: AB640F45B3: to=<>,[]:25, delay=35, delays=0.22/0.02/32/2.6, dsn=2.0.0, status=sent (250 2.0.0 OK 1224347434 g22si7093397rvb.8)

I never received this mail!!!

I get no errors from the php mail function.

The server host name is and the domain is also and we have google apps.

PostPosted: 19. October 2008 19:21
by glitzi85
The log is telling you that the mail was delivered succesfully to the gmail Mailserver. So if you did not recieve it, it was either dropped by the gmail server or it is moved to another account (spam account maybe). You should ask the Google support why the mail did not arrive.


PostPosted: 19. October 2008 19:37
by patcunha
I checked: It was in spam! :-)

But with mail accounts in the same domain as the web server It doesn't work!
Our domain is and we have email accounts provided by google apps using this domain.

PostPosted: 20. October 2008 11:53
by glitzi85
Yes, that makes sense. If Postfix detects that he should deliver a mail that he is responsible for, he will directly process this mail. In this case you should remove the domain from $mydestination and also check $myhostname. Then Postfix will lookup the correct mailserver for this domain and deliver the mail via the smtpd interface.


PostPosted: 20. October 2008 17:03
by patcunha
I followed this and now It works!!!!

PostPosted: 20. October 2008 18:20
by glitzi85
Or you just relay it ;-)

I never set up an relaying Mailserver (i hope i did not *g*), but that's the better solution in this case.