Issue in sending email with SMTP and CodeIgniter - codeigniter

I am using CI for a quiz system. But during sending mail through SMTP. I am getting this error
following SMTP error was encountered: 111 Connection refused
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method
What may be possible reasons of this error.
Configurations used
SMTP
Smtp.gmail.com
467
Gmail username
Gmail password
Mail type text

Related

Laravel Email is not sending due to the Failed to authenticate on SMTP server with username

I have a problem when I send mail from localhost everything works fine, but when sending from the server I don't receive mail and I get an error. Failed to authenticate on SMTP server with username please help me how can resolve that? thanks.
please check the error thanks.
https://flareapp.io/share/RmrlNRN7
Swift_TransportException
Failed to authenticate on SMTP server with username "zubair.bhw#gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor c25sm22236461edt.0 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor c25sm22236461edt.0 - gsmtp ". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials c25sm22236461edt.0 - gsmtp ".
https
.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=zubair.bhw#gmail.com
MAIL_PASSWORD='12345678'
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=zubair.bhw#gmail.com
MAIL_FROM_NAME="${APP_NAME}"
MALE_TO=zubair.bhw#gmail.com
Try port 465 instead of 587 as Gmail normally uses that one. Check if
port is blocked on your live server. Login to your gmail account(
mygmail#gmail.com ). Go to https://myaccount.google.com/security ,
Scroll down till bottom of page. In right you will see: Allow less
secure apps, make sure that option is on.

Laravel SMTP 530 5.7.0 Must issue a STARTTLS command first

I use SMTP to send emails from Laravel 8. It works well in email Notifications but gets the error below while calling Illuminate\Support\Facades\Mail::send:
530 5.7.0 Must issue a STARTTLS command first
I can't find the difference of opening smtp socket between Notification and Mail::send.
I resolved the same error by specifying the encryption on .env property MAIL_ENCRYPTION as tls. Confirm this is done before troubleshooting further if the error persists.

Am experiencing issues with email delivery-"response code 250 but got code '550' "

I am using Exim mail server for my smtp and experiencing an issue when sending emails from the server if the connection is instantiated from within the server. However if I try authenticating from outside, emails are sent without any problems. Am using Laravel which ships with Swift mailer. This is the error laravel is giving out.
production.ERROR: Expected response code 250 but got code "550", with message "550 127.0.0.1 is _my_ address
Exim's log also has a similar error;
H=localhost [127.0.0.1] X=TLSv1:ECDHE-RSA-AES256-SHA:256 CV=no rejected MAIL <no-reply#mydomain.com>: 127.0.0.1 is _my_ address
My .env file has credentials set up correctly as follows
MAIL_DRIVER=smtp
MAIL_HOST=mydomain.com
MAIL_PORT=587
MAIL_USERNAME=no-reply#mydomain.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
The code used to send the emails is as below;
Mail::to('admin#mydomain.com')->send(new AlertEmail($information));
What am wondering is,could the problem be caused by trying to send the email to addresses within the same domain? I hope someone can help me out. Am almost going crazy.
NB: Roundcube is sending emails fine.

trouble with sending mail with Spring mail through somain registrar 1and1 smtp

I'm trying to send an email from a spring boot application with spring mail (1.5.8.RELEASE) JavaMailSender
sending through gmail SMTP is fine. however sending email through my domain registrar's amtp (registrar name- 1and1, in case someone already worked this out) is not working.
I'm getting this error, which imo - is more generic than useful:
com.sun.mail.smtp.SMTPSenderFailedException: 550-Requested action not taken: mailbox unavailable
550 invalid DNS MX or A/AAAA resource record
domain I'm sending through is bank.org, and has this DNS settings:
bank.org. 3600 IN A 178.79.161.205
bank.org. 3600 IN MX 11 mx01.1and1.com.
bank.org. 3600 IN MX 10 mx00.1and1.com.
the issue is, I'm able to send emails to gmail with the settings specified in this guide:
http://www.baeldung.com/spring-email
these are settings to send with gmail:
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=<login user to smtp server>
spring.mail.password=<login password to smtp server>
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
However when i try to send messages via my registrar these settings are not successful:
spring.mail.host=smtp.1and1.com
spring.mail.port=587
spring.mail.username=username
spring.mail.password=password
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
thew issue is - I am able to connect to the 1and1 SMTP using thunderbird email client. so I know the credentials are working.
I guess what I need is to find out a way to detect the correct settings because the support team can't assist with issues related to sending email programmatically from spring mail
the cause of the issue was - I didn't programmatically set the sender field (The "From" field) in my outgoing message
Once i set the From field the issue was resolved.
unfortunately the response from 1and1's SMTP was irrelevant ("550 invalid DNS MX or A/AAAA resource record")
Hope this helps anyone

Help with problem using mail in ruby

The error that I get is:
Net::SMTPFatalError: 550 5.7.1 Unable to relay for you#test.lindsaar.net
I am using mail-2.3.0
With Ruby 1.9
on windows XP.
The exact code I used is:
require 'rubygems'
require 'mail'
Mail.deliver do
from 'me#test.lindsaar.net'
to 'you#test.lindsaar.net'
subject 'Here is the image you wanted'
end
I don't understand what I am missing. Thanks for your help.
The error message comes from your SMTP server. Although this message can have many causes, it is most likely you forgot to provide the necessary authentication data to your SMTP server.
Taken from http://www.eudora.com/techsupport/kb/1593hq.html:
Most Internet Service Providers restrict access to their outgoing mail
servers to prevent SPAM from being sent through their mail servers. If
you are getting the "550 Relay Denied" error message, the outgoing
mail server cannot verify who you are and will not allow you to send
mail.
To configure Mail you have to prepare your own SMTP connection. See https://github.com/mikel/mail/wiki/Sending-email-via-google-smtp for an example.
You can get your username/password from your ISP (the one providing the SMTP server)

Resources