You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.
I'm using a code (see below) to send emails via Gmail smtp servers. Today it suddenly stopped working... Does anybody know about any changes in Google's settings? What's wrong? Thank you for comments!
require_once 'swift/lib/swift_required.php';
// Mail Transport
$transport = Swift_SmtpTransport::newInstance('ssl://smtp.gmail.com', 465)
->setUsername('xxxx') // Your Gmail Username
->setPassword('xxxx'); // Your Gmail Password
// Create a message
$message = Swift_Message::newInstance('xxxxxx')
->setFrom(array('xxxx' => 'xxxx')) // can be $_POST['email'] etc...
->setTo(array($to => $data['jmeno'])) // your email / multiple supported.
->setBody($message, 'text/html');
// Send the message
if ($mailer->send($message)) {
$url = $_SERVER['HTTP_REFERER']; // right back to the referrer page from where you came.
echo '';
} else {
echo 'I am sure, your configuration are not correct. :(';
}
The text was updated successfully, but these errors were encountered:
@janko216 - I don't use GMail, but I would perhaps try to remove the ssl:// from the host and set as ssl for the third parameter in newInstance(). Also try tls as the third parameter. Make sure that your phpinfo() has a Registered Stream Socket Transports readout that includes ssl and tls. Updating to the latest OpenSSL would also be wise as Google is starting to get picky about connecting via old encryption suites.
I'm using a code (see below) to send emails via Gmail smtp servers. Today it suddenly stopped working... Does anybody know about any changes in Google's settings? What's wrong? Thank you for comments!
require_once 'swift/lib/swift_required.php';
// Mail Transport
$transport = Swift_SmtpTransport::newInstance('ssl://smtp.gmail.com', 465)
->setUsername('xxxx') // Your Gmail Username
->setPassword('xxxx'); // Your Gmail Password
// Mailer
$mailer = Swift_Mailer::newInstance($transport);
// Create a message
$message = Swift_Message::newInstance('xxxxxx')
->setFrom(array('xxxx' => 'xxxx')) // can be $_POST['email'] etc...
->setTo(array($to => $data['jmeno'])) // your email / multiple supported.
->setBody($message, 'text/html');
// Send the message
if ($mailer->send($message)) {
$url = $_SERVER['HTTP_REFERER']; // right back to the referrer page from where you came.
echo '';
} else {
echo 'I am sure, your configuration are not correct. :(';
}
The text was updated successfully, but these errors were encountered: