我已经厌倦了通过跟踪发送电子邮件,我找到了解决方案mailgun, 我使用codeigniter框架和swift库发送电子邮件,
这是我的代码
require_once 'lib/swift_required.php';
$email = $this->input->post('to');
$subject = $this->input->post('subject');
$message_body = $this->input->post('isi');
$transport = Swift_SmtpTransport::newInstance('smtp.mailgun.org', 465, "ssl")
->setUsername('myUsernameSMTP')
->setPassword('myPasswordSMTP');
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($subject)
->setFrom(array('krisman.ryuzaki@gmail.com' => 'Ahmad Krisman R.'))
->setTo($email)
->setBody($message_body, 'text/html');
if($result = $mailer->send($message)) {
redirect('pemasaran/index', 'refresh');
}
任何人都可以帮忙