Sunday, 15 June 2014

email - php swiftmailer sending mail with smtp transport timeout -



email - php swiftmailer sending mail with smtp transport timeout -

i trying send mail service via mandrill app using swift mailer. code:

$transport = swift_smtptransport::newinstance('smtp.mandrillapp.com',587); $transport->setusername($username); $transport->setpassword($password); // create mailer using created transport $mailer = swift_mailer::newinstance($transport); // create message $message = swift_message::newinstance() // give message subject ->setsubject('new order '.$reservationnumber) // set address associative array ->setfrom(array('noreply@domain.com' => 'domain.com')) // set addresses associative array ->setto('test@domain.com') // give body ->setbody($body,'text/html'); $mailer->send($message);

credentials 100% good. , timeout error: connection not established host smtp.mandrillapp.com [connection timed out #110].

it looks blocking connection. maybe issue server configurations? using whm software on our centos server

i've been doing battle same problem, smtp.gmail.com. not work, though username/password etc correct.

in case seems when php tries connect smtp.gmail.com, gets ipv6 address - server seems not listening on that, since swiftmailer responds same timeout error get.

but when swapped in ipv4 address (got ping-ing it), connected , sent email fine.

so find out smtp.mandrillapp.com's ipv4 address , seek that ip in place of hostname in code. connect , send now? did me.

it's not ideal coding in ip address - given alter @ min - @ to the lowest degree emails sent

php email smtp centos swiftmailer

No comments:

Post a Comment