Sending Mail via SMTP on Japan ISP - php

I have this weird problem. I have setup my PHP app to send email to users, for now it is using gmail. There is no problem sending mail from my machine. But when my colleague in Japan tried my app, it doesn't send the mail. In the logs, it says that the app failed to authenticate.
'driver' => 'smtp',
'smtp' => array(
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'username' => 'test.email#gmail.com',
'password' => 'password',
'timeout' => 5,
),
'newline' => "\r\n"
He is running the app in his machine, not from a remote server.

Google might have blocked your login because it was deemed as suspicious. (https://support.google.com/accounts/answer/6063333?hl=en)
You might want to login to this account and navigate to https://security.google.com/settings/security/activity and allow blocked device to continue.

Related

Why the Swiftmailer in Yii2 does not work and IP in blacklist?

The email was worked, but now it is crash because IP is blacklisted.
How to resolve this problem?
When I send email using Swiftmailer this error I see
Expected response code 220 but got code "550", with the message
"550-Message rejected because [50.87.249.98]:20423 is blacklisted see
Blocked - 550 Too many failed logins "
This code in conmmon/config/main-local.php
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'box1298.bluehost.com',
'username' => 'test#domain.co', // my email
'password' => '**************', // password
'port' => 465,
'encryption' => 'ssl',
'streamOptions' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
]
],
],
This has nothing to do with your code. If your SMTP server blocks your IP you should contact with your hosting provider and ask about unblocking this IP. Or wait - such blocks are usually temporary.
But in your case it looks like your server blocked itself, so I suggest to contact with hosting support to explain the situation.
Shameless plug: you can use a free email API like Flute Mail which automatically circumvents temporary blacklists. How it works: you can setup multiple email servers or providers on your Flute account, and it will resend your email through a different provider if it detects an error like this.
It's completely free for small volume senders, so all you need to do is change your code to forward requests through your Virtual Flute (and then pop replace your SMTP credentials). The Virtual Flute will need to be be configured to send through your SMTP server (or other free email APIs like Mailgun).
Let me know if you have any questions about Flute (I built it).

Swift_TransportException: Failed to authenticate on SMTP server on 000webhostapp.com

In trying to send email using SwiftMailer.
$app['swiftmailer.options'] = array(
'host' => 'smtp.gmail.com',
'port' => '465',
'username' => 'mymail#gmail.com',
'password' => 'mypassword',
'encryption' => 'ssl',
'auth_mode' => 'login'
);
$message = (new Swift_Message('Title'))
->setFrom(array('mymail#gmail.com'))
->setTo(array($mail_to))
->setBody($text);
$app['mailer']->send($message);
This configuration works on my local virtual host. But when I deployed my application on 000webhost.com I get an exception.
Uncaught Swift_TransportException: Failed to authenticate on SMTP
server with username "mymail#gmail.com" using 1 possible
authenticators in
/storage/ssd5/070/4187070/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php:181
I didn't find any solutions for troubles on hosting services. Also I allowed access from unknown applications on gmail settings and visited DisplayUnlockCaptcha. That didn't help me
Maybe something wrong with the hosting service. Please help me to solve this problem!

Sending Emails via Swiftmailer in Yii2 won't work on external Server

I am using Swiftmailer in Yii2 advanced and everything, this includes sending emails, works fine on my xampp server. But when I try it on my external Server (1&1 btw) I get a
Swift_TransportException
Connection could not be established with host
smtp.1und1.de [Connection timed out #110]
I already googled about it for hours an tried almost every solution including using gmail instead or using ports 465 and 25 with ssl and tls. Also using IP-Adress instead of hostname.
I feel like there could be a firewall or some email options I miss but I have tried everything I can think of.
My code looks like this:
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '#common/mail',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.1und1.de',
'username' => 'mymail#myadress.de',
'password' => 'mypassword',
'port' => '587',
'encryption' => 'tls',
],
],
and again, works perfectly fine on localhost.
Maybe someone has an idea what I am doing wrong?

Failed to authenticate on SMTP server with username using 2 possible authenticators

I've configured to gmail SMTP server to send email. Account less secure app turned ON, also Recapture thing enabled. Here is the mail.php configuration.
This code working fine on hostgator server. But we have another server, mails are not sending from that server. What should I do now?
Error image
http://screencast.com/t/BSCurEEubPJV
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => 'xxx#gmail.com', 'name' => 'xxxxTeam'),
'encryption' => 'tls',
'username' => 'xxx#gmail.com',
'password' => 'xx#123',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
I got the same issue. Finally found that my server IP address was blacklisted.
Please check your IP address using this link.
Link : https://mxtoolbox.com/blacklists.aspx
If it is blacklisted, send re-list request via they provide links. That's it
Thank you

Swift_TransportException Failed to authenticate on SMTP server with username email#domain.com using 2 possible authenticators on shared host

I'm develop a website using Laravel 4.1. I config my email system and send email successfully on built-in server localhost:8000. But when I host the web on a shared hosting, it always tell: Swift_TransportException
Failed to authenticate on SMTP server with username "email#domain.com" using 2 possible authenticators
I don't know what the reason is? I've search on this site but no solution works.
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => 'email#gmail.com', 'name' => 'Test email'),
'encryption' => 'ssl',
'username' => 'your_gmail_username',
'password' => 'your_gmail_password',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
I also used my our domain's email but it doesn't work neither. Hope for help.
In my case, I had a Cpanel dedicated server. My host informed me that exim mail server was failing and restarting a couple times a day.
It looked like all connection threads were being used up and then locked until it restarts.
My host added another 100 connection threads to the pool. Most probably this help you as well.

Categories