使用POSTFIX和SWIFTMAILER、PHP发送电子邮件
我已安装(今天更新,2012年12月2日)。它与Oracle VM VirtualBox一起使用。 此虚拟服务器具有linux、apache、php、mysql和Postfix MTA(绑定到localhost),允许从web应用程序发送电子邮件 问题是我不能用Postfix发送邮件,因为我不知道使用哪个用户名或密码,或者端口 我使用PHP代码发送邮件。 我已使用我的一个网站服务器成功发送邮件:使用POSTFIX和SWIFTMAILER、PHP发送电子邮件,php,lamp,postfix-mta,swiftmailer,turnkeylinux.org,Php,Lamp,Postfix Mta,Swiftmailer,Turnkeylinux.org,我已安装(今天更新,2012年12月2日)。它与Oracle VM VirtualBox一起使用。 此虚拟服务器具有linux、apache、php、mysql和Postfix MTA(绑定到localhost),允许从web应用程序发送电子邮件 问题是我不能用Postfix发送邮件,因为我不知道使用哪个用户名或密码,或者端口 我使用PHP代码发送邮件。 我已使用我的一个网站服务器成功发送邮件: // Create the Transport $transport = Swift_SmtpTra
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('localhost', 465, 'ssl')
->setUsername('myusername@mywebsite.net')
->setPassword('mypassword')
;
或者使用我的gmail帐户:
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
->setUsername('myusername@gmail.com')
->setPassword('mypassword')
;
Swiftmailer支持后缀,这是写在他们的文档中的
我使用Lamp虚拟服务器的Postfix邮件服务器接口。
请问,你能告诉我怎样用这些发邮件吗 要使用Postfix(sendmail),您需要使用与SwiftMailer捆绑的sendmail传输。没有什么例子:
// Create the Transport
$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
我找不到任何可以工作的代码,所以我停止使用lamp服务器。我成功地在我购买的另一台服务器上发送邮件。