Question

Send mail via smtp or php mail fnction

Posted January 24, 2019 1.3k views
CentOS Email

Hello team
i tried to send mail out by connect to my gmail and php mail function, but it seem likes not working, your server deny send mail out? or i wrong some config information on my server?
this is the log i send mail out by php mail function
My unqualified host name (centos-512mb-sgp1-01) unknown; sleeping for retry
this is the log send by phpmailler(the php library send mail via smtp)
Jan 24 18:22:19 centos-512mb-sgp1-01 postfix/qmgr[29831]: 442CE41923: from=apache@centos-512mb-sgp1-01.localdomain, size=1431, nrcpt=1 (queue active)
Jan 24 18:22:19 centos-512mb-sgp1-01 postfix/qmgr[29831]: 45F3B3F256: from=root@centos-512mb-sgp1-01.localdomain, size=604, nrcpt=1 (queue active)
Jan 24 18:22:19 centos-512mb-sgp1-01 postfix/qmgr[29831]: A2B44403C9: from=root@centos-512mb-sgp1-01.localdomain, size=542, nrcpt=1 (queue active)
Jan 24 18:22:19 centos-512mb-sgp1-01 postfix/error[30105]: 45F3B3F256: to=ngodanghuuha@gmail.com, relay=none, delay=1072, delays=1072/0.01/0/0.01, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to alt2.gmail-smtp-in.l.google.com[2607:f8b0:4003:c09::1b]:25: Connection timed out)
Jan 24 18:22:19 centos-512mb-sgp1-01 postfix/error[30106]: A2B44403C9: to=ngodanghuuha@gmail.com, relay=none, delay=471, delays=471/0.02/0/0, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to alt2.gmail-smtp-in.l.google.com[2607:f8b0:4003:c09::1b]:25: Connection timed out)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Configure a fully qualified domain name for your hostname. Something like server.example.com then give the hostname the IP of the droplet in the DNS management system for your domain. Make sure to set this hostname in your DO control panel too (so the reverse DNS for your DO IP resolves properly). You’ll then need to set SPF records so this server is authorized to send email on behalf of your domain. There are more things to do to ensure proper mail delivery. But this is a good start.

Cheers

  • it looks like my server can not connect to gmail or another server by port 465 and 587 even i turn on the port 465 and 587 by firewall
    i dont know what is happening here
    thank you for your answer

Submit an Answer