We know that when using
PHP Swift to implement specific code examples for sending emails:
- < ?php
- include_once ("Swift.php");
- include_once ("Swift/Connection /SMTP.php");
- include_once ("Swift/Authenticator/LOGIN.php");
- //Recipient’s Address
- $receive_mail="demo_receive@gmail.com";
- // Create smtp connection, due to the email smtp address and port for sending emails
- $smtp = new Swift_Connection_SMTP
('smtp.sina.com', 25); - // Set for sending emails Email account
- $smtp->setUsername('demo_send@sina.com');
- //Set the email login password for the outbox
-
$smtp->setPassword('1qaz2wsx') ;
- //Add ssl connection support. Without this item, sending to emails that require ssl connection such as gmail
will fail, but turning this option
will affect Email sending speed - if(stripos($receive_mail,"@gmail.com")!==false){
-
$smtp ->attachAuthenticator(new
Swift_Authenticator_LOGIN());
- }
-
$swift = new Swift($smtp);
- //Email Title
-
$title="You have received a new resume for a job as a PHP programmer Position";
- //Email text
-
$content="Hello, administrator! You have received a new resume,
Apply for the position of php programmer...< br/>";
-
$message = new Swift_Message
($title, $content, 'text/html', 'base64') ;
-
echo ($swift->send( $message,
$receive_mail, new Swift_Address
(' demo_send@sina.com','demo_sender')))
?'Success':'Failure';
-
?>
I hope the above introduction to how to use PHP Swift can be helpful to friends who need it again
http://www.bkjia.com/PHPjc/446173.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446173.htmlTechArticleWe know that there are specific code examples for using PHP Swift to send emails: ?php include_once(Swift.php); include_once(Swift/Connection/SMTP.php); include_once(Swift/Authenticator...