I just started learning how to use SwiftMailer and I am having trouble sending a simple test message from my localhost. Below is the code that I am trying to use.
//Pass it as a parameter when you create the message
$message = Swift_Message::newInstance();
$message->setSubject('My subject');
$message->setFrom(array('[email protected]' => 'No Reply'));
$message->setTo(array('[email protected]' => 'My Name'));
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 25);
//Supposed to allow local domain sending to work from what I read
$transport->setLocalDomain('[127.0.0.1]');
$mailer = Swift_Mailer::newInstance($transport);
//Send the message
$result = $mailer->send($message);
Here is part of my error message,
Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]:php_network_getaddresses: getaddrinfo failed: Name or service not known in /path/Swift/Transport/StreamBuffer.php
Update
I got it to work using gmail. I changed the Swift_SmtpTransport line to the following,
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')->setUsername('username')->setPassword('password');