Ali*_*dru 5 php lamp postfix-mta swiftmailer turnkeylinux.org
我已经安装了TURNKEY LAMP(今天更新,2012年12月2日).它与Oracle VM VirtualBox一起使用.这个虚拟服务器有linux,apache,php,mysql和Postfix MTA(绑定到localhost),允许从Web应用程序发送电子邮件.
问题是我无法使用Postfix发送邮件,因为我不知道使用哪个用户名或密码,或者端口.
我使用PHP代码发送邮件SwiftMailer.我已经使用我的一个网站服务器成功发送邮件:
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('localhost', 465, 'ssl')
->setUsername('myusername@mywebsite.net')
->setPassword('mypassword')
;
Run Code Online (Sandbox Code Playgroud)
或使用我的Gmail帐户:
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
->setUsername('myusername@gmail.com')
->setPassword('mypassword')
;
Run Code Online (Sandbox Code Playgroud)
Swiftmailer支持PostFix,它是在他们的文档中编写的.
我从我的Lamp虚拟服务器使用Postfix邮件服务器接口. 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);
Run Code Online (Sandbox Code Playgroud)