简体   繁体   中英

Swiftmailer won't send email, but a SMTP client will

I'm trying to send an email using swift_smtptransport that will connect to 127.0.0.1:25 I'm using the following code:

$message = Swift_Message::newInstance();

$message->setSubject('Test mail');
$message->setFrom('admin@localhost');
$message->setTo('peter@localhost');
$message->setBody('Test message');

$num = $this->getMailer()->send($message, $failures);

print_r($failures);

echo $num; 

The result is: array() 0 as nothing happend, no exception, no nothing.

I'm using mercury email server and the log says only:

Connection from 127.0.0.1, Sat Jun 04 23:46:56 2011
EHLO [127.0.0.1]
QUIT
0 sec. elapsed, connection closed Sat Jun 04 23:46:56 2011

but after I've tried to send an email with thunderbird the log says:

Connection from 127.0.0.1, Sat Jun 04 23:39:20 2011
EHLO [127.0.0.1]
MAIL FROM:<peter@localhost> SIZE=381
RCPT TO:<peter@localhost>
DATA
DATA - 11 lines, 381 bytes.
QUIT
0 sec. elapsed, connection closed Sat Jun 04 23:39:20 2011

Check configuration for the dev environment, the switfmailer delivery_strategy option is set to none, inside factories.yml.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM