Note that there are some explanatory texts on larger screens.

plurals
  1. POSending email with Swift Mailer, GMail and PHP, Permission Denied Error
    primarykey
    data
    text
    <p>I downloaded SwiftMailer 4.1.6 for sending email using Gmail. I had written the following code for that purpose.</p> <pre><code>&lt;?php require_once 'swiftmailer/lib/swift_required.php'; $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl") -&gt;setUsername('jomit.jmt@gmail.com') -&gt;setPassword('***********'); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance('Wonderful Subject') -&gt;setFrom(array('jomit.jmt@gmail.com' =&gt; 'Jomit Jose')) -&gt;setTo(array('jomit.jmt@gmail.com' =&gt; 'Jomit Jose')) -&gt;setBody('This is the text of the mail send by Swift using SMTP transport.'); $numSent = $mailer-&gt;send($message); printf("Sent %d messages\n", $numSent); </code></pre> <p>and it resulted in the following error:</p> <pre><code>Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.gmail.com [Permission denied #13]' in /home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:266 Stack trace: #0 /home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(66): Swift_Transport_StreamBuffer-&gt;_establishSocketConnection() #1 /home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(117): Swift_Transport_StreamBuffer-&gt;initialize(Array) #2 /home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport-&gt;start() #3 /home/jomit/public_html/email_test/test.php(16): Swift_Mailer-&gt;send(Object(Swift_Message)) #4 {main} thrown in /home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 266 </code></pre> <p>What could have been go wrong? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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