<?php
require_once 'lib/swift_required.php';
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
->setUsername('[email protected]')
->setPassword('password')
;
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('HomeWork')
->setFrom(array('[email protected]' => 'NAME'))
->setTo(array('[email protected]'=> 'NAME'))
->setBody('Test Message Body')
;
$mailer->send($message);
?>
It works but sender is '[email protected]'. How can I specify any other email address in order to send fake email?
Gmail disallows overriding the FROM name except from verfied email addresses that you prove to gmail you own. Either choose a different email server or go to your gmail settings and change it to another valid email address that you can receive email from.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With