<?php
require_once 'lib/swift_required.php';
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
->setUsername('username@gmail.com')
->setPassword('password')
;
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('HomeWork')
->setFrom(array('exampleFROM@gmail.com' => 'NAME'))
->setTo(array('exampleTO@gmail.com'=> 'NAME'))
->setBody('Test Message Body')
;
$mailer->send($message);
?>
It works but sender is 'username@gmail.com'. How can I specify any other email address in order to send fake email?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…