aspSmartMail object for PHP
Is there a mail object like aspSmarMail that I can call from a PHP script specifying the 'server', 'senderaddress', 'recipient', etc开发者_运维技巧. sub-properties? For example in MS Visual Foxpro9 I can use this code:
loIP = CREATEOBJECT( "aspSmartMail.SmartMail" )
loIP.server = "mailout.my.domain.com"
loIP.SenderName = "Emailer"
loIP.SenderAddress = "madeupname@No-Reply.com"
loIP.Recipients.Add( "sadmicrowave@gmail.com" )
loIP.Subject = "Emailer Subject"
loIP.ContentType = "text/html"
loIP.Charset = "us-ascii"
loIP.Body = "This is the body of the email"
loIP.SendMail()
basically this will relay the generated email to the 'mailout.my.domain.com' mailserver and it will be sent out that way instead of having to install a SMTP MTA on my localhost.
Is there some syntax to allow me to do this?
can call from a PHP script specifying the 'server', 'senderaddress', 'recipient', etc. sub-properties
While it's kind of possible to make PHP's built-in mail
function communicate with an arbritary SMTP server, doing it sanely is difficult. The best way to work with an SMTP server in PHP would be using a third-party mailing library.
SwiftMailer comes highly recommended in these parts, but PHPMailer and PEAR's Mail package are also capable of communicating directly with an SMTP server.
Check out SwiftMailer's documentation on sending via SMTP and the way it assembles messages for a quick howto.
You should check our SwiftMailer, I recommend for all my customers on our hosting platform, it's very flexible:
SwiftMailer - Free Feature-rich PHP Mailer/
精彩评论