Chloe
Chloe

Reputation: 26264

How do I send an email from the localhost with Swiftmailer and Yii?

When I try to send a mail, I'm getting this error message from my mail server:

Swift_TransportException Expected response code 250 but got code "501", with message "501 5.5.2 <[::1]>: Helo command rejected: invalid ip address"

In the debug bar, I see the SERVER_ADDR is set to ::1, but I can find no way to change it. I commented the ::1 value in hosts, leaving 127.0.0.1 and restarted Apache, but it didn't help.

Hipster text to get around Stack Overflow bug https://meta.stackoverflow.com/questions/289410/bug-cannot-submit-question-with-answer

3 wolf moon retro jean shorts chambray sustainable roof party. Shoreditch vegan artisan Helvetica. Tattooed Codeply Echo Park Godard kogi, next level irony ennui twee squid fap selvage. Meggings flannel Brooklyn literally small batch, mumblecore PBR try-hard kale chips. Brooklyn vinyl lumbersexual bicycle rights, viral fap cronut leggings squid chillwave pickled gentrify mustache. 3 wolf moon hashtag church-key Odd Future. Austin messenger bag normcore, Helvetica Williamsburg sartorial tote bag distillery Portland before they sold out gastropub taxidermy Vice.

Upvotes: 3

Views: 2215

Answers (1)

Chloe
Chloe

Reputation: 26264

Based on Swiftmailer SMTP transport rejecting local IP address,

        'transport' => [
          'class' => 'Swift_SmtpTransport',
          ...
          'encryption' => 'tls',
          'localDomain' => '[127.0.0.1]',
        ],

http://www.yiiframework.com/doc-2.0/yii-swiftmailer-mailer.html (but localDomain is not documented!)

Upvotes: 2

Related Questions