what is the exact code needed for a php to interact with an smtp server and send email? [duplicate]
Possible Duplicate:
Sending mass email using PHP
Does anyone out there know? I am trying to set up a php file to send data submitted in a form to a mysql database and also one of three email addresses (by means of an if statement). However, I am being told, I need to set up and manage an smtp server and also write code in my php file that connects with smtp server so that it will be possible for me to send email. However, I don't know how to do any of these things and if there is someone out there who does, would you mind helping me out? If so, I would gre开发者_StackOverflow中文版atly appreciate it.
I don't know if anybody is going to give you exact code, but I highly recommend the SwiftMailer library.
Read through the documentation a bit and try it out. It supports sending through your SMTP server instead of using the PHP mail()
function.
If you are familiar with Zend framework, there is also a pretty advanced mail feature : Zend_Mail
Reading the PHP manual's page for mail() would be a good start
PHP doesn't actually send the mail. You need a mail server setup on a host machine that is listening for connections. Then in your code you can just use the mail
command to actually send the email.
精彩评论