用Swift邮件发送
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用Swift邮件发送相关的知识,希望对你有一定的参考价值。
Script to send mails with Swift Mailer
<?php require_once 'lib/swift_required.php'; include "conexion.php"; $correo = $_POST['correo']; //Mail Receiver //Create the Transport $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 25) ->setPassword('password') ; /* You could alternatively use a different transport such as Sendmail or Mail: //Sendmail $transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs'); $transport = Swift_MailTransport::newInstance(); */ //Create the Mailer using your created Transport $mailer = Swift_Mailer::newInstance($transport); //Create a message $message = Swift_Message::newInstance('Banco de Ideas') ->setBody('Your message...') ; //Send the message $result = $mailer->send($message); /* You can alternatively use batchSend() to send the message $result = $mailer->batchSend($message); */ ?>
以上是关于用Swift邮件发送的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 Swift 代码 (macOS) 发送电子邮件背景