Reputation: 1
I've looked everywhere and cannot find a solution for this. I just put up a website using GoDaddy hosting. The website has a form, which uses Gmail SMTP and was working perfectly when I was running a virtual host with XAMPP. After hosting with GoDaddy however, I get the following error when I try to submit:
Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.gmail.com [Connection refused #111]' in /home/modernautoinc/public_html/Swift/lib/classes/Swift/Transport/StreamBuffer.php:259 Stack trace: #0 /home/modernautoinc/public_html/Swift/lib/classes/Swift/Transport/StreamBuffer.php(64): Swift_Transport_StreamBuffer->_establishSocketConnection() #1 /home/modernautoinc/public_html/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php(115): Swift_Transport_StreamBuffer->initialize(Array) #2 /home/modernautoinc/public_html/Swift/lib/classes/Swift/Mailer.php(80): Swift_Transport_AbstractSmtpTransport->start() #3 /home/modernautoinc/public_html/mech.php(24): Swift_Mailer->send(Object(Swift_Message)) #4 {main} thrown in /home/modernautoinc/public_html/Swift/lib/classes/Swift/Transport/StreamBuffer.php on line 259
Here is my php:
<?php
require_once 'Swift/lib/swift_required.php';
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$make = $_REQUEST['make'];
$model = $_REQUEST['model'];
$VIN = $_REQUEST['VIN'];
$problem = $_REQUEST['problem'];
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl")
->setUsername('[email protected]')
->setPassword('example');
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Appointment: Mechanical')
->setFrom(array($email => $name))
->setTo(array('[email protected]' => 'MA'))
->setBody("From: ".$email."\nName: ".$name."\nPhone Number: ".$phone."\nMake: ".$make."\nModel: ".$model."\nVIN: ".$VIN."\nDescription of Problem: ".$problem);
$mailer->send($message);
header('Location: http://www.google.ca');
?>
Any help would be greatly appreciated. Thank you for your time.
Upvotes: 0
Views: 2485
Reputation: 51
For GoDaddy Hosting, I've configured my Silex app like this :
$app['swiftmailer.options'] = array(
'host' => 'p3plcpnl0689.prod.phx3.secureserver.net',
'port' => 465,
'username' => '[email protected]',
'password' => 'your pass',
'encryption' => 'ssl'
);
and it works like a charm!!
Upvotes: 2