Work experience |

 Your Ad Here

Simple smtp solution for PHP |


When I was trying to send some mail using PHP function mail() it failed, because there were no postfix or sendmail configured. I didn't need whole smtp functionality, so I installed ssmtp (extremely simple MTA to get mail off the system to a mail hub) and changed config /etc/ssmtp/ssmtp.conf

# # /etc/ssmtp.conf -- a config file for sSMTP sendmail. # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=vaidas # The place where the mail goes. The actual machine name is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com # The example will fit if you are in domain.com and your mailhub is so named. mailhub=smtp.server.dom # Example for SMTP port number 2525 # mailhub=mail.your.domain:2525 # Example for SMTP port number 25 (Standard/RFC) # mailhub=mail.your.domain # Example for SSL encrypted connection # mailhub=mail.your.domain:465 # Where will the mail seem to come from? rewriteDomain=rewrite.dom # The full hostname # Gentoo bug #47562 # Commenting the following line will force ssmtp to figure # out the hostname itself. # hostname=_HOSTNAME_ # Set this to never rewrite the "From:" line (unless not given) and to # use that address in the "from line" of the envelope. FromLineOverride=YES # Use SSL/TLS to send secure messages to server. #UseTLS=YES # Use SSL/TLS certificate to authenticate against smtp host. #UseTLSCert=YES # Use this RSA certificate. #TLSCert=/etc/ssl/certs/ssmtp.pem


From now all emails are forwarded to "smtp.server.dom"
To test ssmtp configuration you can execute such command:

srnam ~ # echo test | ssmtp -s from@someone.com to@someone.com


Comments:


Date: 10/01/2007 at 15:36:14
Poster: Vaidas

Try to read here:
http://epkb.stbernard.com/webhelp/Model_500/TroubleShooting/MailDelivery/EP0069.htm

maybe you have enabled greylisting on your server?


Date: 09/24/2007 at 18:49:41
Poster: William McKee

I tried using this configuration but always get the following error:

451 Please try again later

Any ideas?


Name:
captcha