Note that there are some explanatory texts on larger screens.

plurals
  1. POtrying to send mail using swift mailer, gmail smtp, php
    text
    copied!<p>Here is my code:</p> <pre><code>&lt;?php require_once 'Swift/lib/swift_required.php'; $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465) -&gt;setUsername('me@ff.com') -&gt;setPassword('pass'); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance('Wonderful Subject') -&gt;setFrom(array('me@ff.com' =&gt; 'MY NAME')) -&gt;setTo(array('you@ss.com' =&gt; 'YOU')) -&gt;setBody('This is the text of the mail send by Swift using SMTP transport.'); //$attachment = Swift_Attachment::newInstance(file_get_contents('path/logo.png'), 'logo.png'); //$message-&gt;attach($attachment); $numSent = $mailer-&gt;send($message); printf("Sent %d messages\n", $numSent); ?&gt; </code></pre> <p>AFter RUNNING GOT THIS ERROR...</p> <blockquote> <p>Fatal error: Uncaught exception 'Swift_TransportException' with message 'Expected response code 220 but got code "", with message ""' in /home/sitenyou/public_html/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php:406 </p> </blockquote> <pre><code>Stack trace: #0 /home/sitenyou/public_html/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php(299): Swift_Transport_AbstractSmtpTransport-&gt;_assertResponseCode('', Array) #1 /home/sitenyou/public_html/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php(107): Swift_Transport_AbstractSmtpTransport-&gt;_readGreeting() #2 /home/sitenyou/public_html/Swift/lib/classes/Swift/Mailer.php(74): Swift_Transport_AbstractSmtpTransport-&gt;start() #3 /home/sitenyou/public_html/sgmail.php(16): Swift_Mailer-&gt;send(Object(Swift_Message)) #4 {main} thrown in /home/sitenyou/public_html/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 406 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload