Are you frustrated with “Moodle SMTP error could not authenticate”?
Though moodle comes with many standard features, it is never free of errors. An SMTP authentication error is a tricky moodle error.
This occurs mainly due to errors in SMTP fields in moodle configuration, incorrect moodle settings and so on.
At Bobcares, we often receive requests to fix moodle errors as part of our Server Management Services.
Today, let’s have a clear-cut discussion on this error and see how our Support Engineers fix it.
Why moodle SMTP error could not authenticate occur?
Before getting much into the error, let’s have a brief look at Moodle.
What is moodle? It is an online educational platform for students.
Usually, we use moodle to have an organized interface for e-learning.
It provides a custom learning environment for students and so is used widely in educational institutions. It comes with built-in mail functionality too.
The basic cause for moodle SMTP authentication is the incorrect SMTP settings in the moodle configuration. Also, some other errors like wrong port, incorrect SSL, etc. can also cause the error.
How to fix this SMTP authentication error?
So far we have discussed the error and its main causes. Now, let’s check how it could be resolved easily.
1. Error in SMTP fields
Usually, the messages sent from Moodle go through the SMTP server connection.
An SMTP connection will connect to an email server with login credentials, authenticating the sending email address.
And, this will allow the receiving mail server to accept the email as authenticated. But, minute mistakes while configuring moodle to use SMTP will cause authentication errors.
So, we double-check the SMTP fields to get rid of such errors from
Dashboard >> Site administration>> Server >> Email >> Outgoing mail configuration
Configuring SMTP settings in Moodle
- Firstly, we log in to the Moodle dashboard.
- Then, navigate to Site administration >> Plugins >> Message outputs >> Email in the settings section.
- Nextly, we configure the SMTP settings. These configuration depends on the preferred mail server like Gmail, Yahoo, etc.
- We configure the fields like SMTP hosts, SMTP security, SMTP username, SMTP password for the mail to work.
- Finally, we click on Save changes after filling the fields with correct information.
Setting this correctly as per the above steps will resolve the error and moodle will work fine then on.
2. Other incorrect settings
Recently, one of our customers approached us with a moodle SMTP error. He was using the Gmail server and getting authentication errors while sending emails.
Our Support Engineers checked the error in detail. This error occurred due to missing SSL connection.
The SMTP security settings will vary on the email server’s SMTP requirements. And as he was using Gmail, SSL was mandatory for the connection.
Therefore, setting up SSL resolved the error efficiently.
Similarly, we need to double-check the port number attached to the Server hostname to avoid errors.
Also, we recommend flushing the Moodle cache. For that, log in to the Moodle site as admin, navigate to Site Administrator > Development > Purge all Caches
[Need more help to fix Moodle error?- We’re available 24/7 to help you.]
Conclusion
In short, Moodle SMTP error could not authenticate occurs mainly due to errors in Moodle SMTP server configuration, incorrect Moodle settings and so on. In today’s article, we saw the main causes of this error and its most appropriate fix by our Support Engineers.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
HI
We currently have three Moodle 2.0 (build 20110209) installations and receive the ‘SMTP Error:Could not authenticate’ and none of the subscribed users receive an email when a forum post is sent from these installations. I, as an admin, recieve the following message within an email:
Insert into log table failed at Wednesday 16th of February 2011 11:57:28 AM.
It is possible that your disk is full.
The failed query parameters are:
array (
‘time’ => 1297857448,
‘userid’ => ‘2’,
‘course’ => ‘1’,
‘ip’ => ‘10.10.10.14’,
‘module’ => ‘library’,
‘cmid’ => 0,
‘action’ => ‘mailer’,
‘url’ => NULL,
‘info’ => ‘ERROR: SMTP Error: Could not authenticate.’,
)
When I look at the cron log, it has the following message:
<br />SMTP Error: Could not authenticate.
ERROR: SMTP Error: Could not authenticate.
++ Error: Could not insert a new entry to the Moodle log ++
* line 1691 of /lib/datalib.php: call to debugging()
* line 4742 of /lib/moodlelib.php: call to add_to_log()
* line 63 of /message/output/email/message_output_email.php: call to email_to_user()
* line 152 of /lib/messagelib.php: call to message_output_email->send_message()
* line 644 of /mod/forum/lib.php: call to message_send()
* line 87 of /lib/cronlib.php: call to forum_cron()
* line 79 of /admin/cron.php: call to cron_run()
</pre>++ Error calling message processor email ++
* line 153 of /lib/messagelib.php: call to debugging()
* line 644 of /mod/forum/lib.php: call to message_send()
* line 87 of /lib/cronlib.php: call to forum_cron()
* line 79 of /admin/cron.php: call to cron_run()
Error: mod/forum/lib.php forum_cron(): Could not send out mail for id 36 to user 28 (blahblah@somemailco.co.uk) .. not trying again.
post 36: another test
0 users were sent post 36, ‘another test’
We have Moodle v 1.9 on the same server with the exact same SMTP settings and this install is sending emails accordingly.
Ali
I have the same error, since i made an upgrade to 2.0.1
I had to clear the smtp fields in moodle configuration. Now it’s working, but i would like to use smtp authetication.
Hope this can be fixed in 2.0.2
Just upgraded to 2.0.2+ (build 20110221) and still receive the same error. Has this been reported as I can’t find it within the tracker?
Ali
Same error here!
Running moodle 2.0.2 on an Ubuntu server 10.04
Whats more weird is that i have a moodle 1.9 running on an Ubuntu server 8.04 with the exact same configuration of mail preferences and everything works like a charm.
Does someone have been able to solve this? Very much apreciate it, thats the only left for complete migration.
thanks
After a couple of days reading in forums i realize my mail server works alike as gmail.
So i follow this guide.
This part of the document solves my problem:
Code Modification
In your Moodle site go to /lib/phpmailer/ and modify the following file:
class.smtp.php
Around line 83 DIRECTLY after the Connect function header, insert this line immediately after the «{» :
$host = 'ssl://' . $host;hopes this helps someone with the same problem.
Equally I had this issue and I corrected in in the /lib/phpmailer/class.phpmailer.php file — overriding the SMTP hosted directly my the required information.
Once completed I then removed the SMTP information from the installation itself from site adminserveremail everything now works fine.
Ive tried this solution, the error messages disappear and I do personally receive emails as the Moodle support but its an undeliverable messages I receive.
Basically all my users within Moodle 2 do not receive emails
Did any of you ever get this problem solved. I am using the latest version of 2 on an Ubuntu server as well (10.04) and still have this same problem. And, as someone mentioned, I have 1.9 installed on the same server and it sends e-mails fine. I really don’t want to downgrade now that I have content on my 2.1 site but without e-mails being sent from the forums Moodle is VERY handicapped.
Jason
Hi, I just solved my problem and want to share the solution with you.
It was a line addition to moodlelib.php ( in the lib directory)
Find the line :
$mailer->IsSMTP();
and under this line , insert
$mailer->SMTPSecure = «tls»;
if you use TLS of course. After this, e-mail system was working without any problems.
I hope it helps.
Hello I am getting this error «Language string failed to load: tls ERROR: Language string failed to load: tls » please help me on this…
same situation as us. 2.1 all ready to replace 1.9 but can’t until this problem is sorted. using same server and settings as 1.9 installation but getting the ‘could not substantiate’ error.
we’re also having issues with ldap installation. moodle doesn’t accept it is enabled when it is!!
haven’t been able to find refernces that have helped yet.
I’ve just set-up Moodle 2.3.3 on Windows Server 2008 R2, IIS7.5, SQL Server 2008 R2 & PHP 5.3.13
I set-up SMTP Authentication with TLS on port 25.
My email server was responding with: rsp: 535 Authentication failed
After several hours, largely due to the lack of a Moodle smtp testing feature, I realised it was that I had used a £(pound) sign in my paranoid password. When I removed it, all was well — I noticed a similar issue with the database password.
Please check these things before submitting your issue:
- Read the error message you’re seeing — it often tells you what is wrong, and may contain useful links & instructions
- Make sure you’re using the latest version of PHPMailer
- Check that your problem is not dealt with in the troubleshooting guide, especially if you’re having problems connecting to Gmail or GoDaddy
- Include sufficient code to reproduce your problem
- If you’re having an SMTP issue, include the debug output generated with
SMTPDebug = 2
set - If you have a question about how to use PHPMailer (rather than reporting a bug in it), tag a question on Stack Overflow with
phpmailer
, but search first!
Problem description
Code to reproduce
Debug output
That server is accessible to me; your ISP is blocking your outbound SMTP, as the docs say.
Can you please elaborate i am not able to get you?
If I do telnet rsixchange.ramco.com 25
, it connects correctly. If you do the same from your server, it probably will not work. This procedure is described in the troubleshooting guide. It means your hosting provider is preventing you form connecting to the mail server, so it’s nothing to do with your code.
ok.. let me check in my server.. please be connected and help me to rectify this issue
There’s really nothing I can do — ask your hosting provider’s support services.
Hi marcus, telnet is connected in my server too. but still i am getting the error. i have tested a sample test mail from the server too. it is working. but through moodle i am not able to send or receive mail.
2019-04-15 10:00:53 Connection: opening to rsixchange.ramco.com:25, timeout=300, options=array()
2019-04-15 10:00:53 Connection: opened
2019-04-15 10:00:53 SERVER -> CLIENT: 220 IMGEXWCNV01.rsimail.rsil.ramco.com Microsoft ESMTP MAIL Service ready at Mon, 15 Apr 2019 15:31:23 +0530
2019-04-15 10:00:53 CLIENT -> SERVER: EHLO learningsupport.ramco.com
2019-04-15 10:00:53 SERVER -> CLIENT: 250-IMGEXWCNV01.rsimail.rsil.ramco.com Hello [172.16.20.20]
250-SIZE 104857600
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-AUTH
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 XEXCH50
2019-04-15 10:00:53 SMTP Error: Could not authenticate.
2019-04-15 10:00:53 CLIENT -> SERVER: QUIT
2019-04-15 10:00:53 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
2019-04-15 10:00:53 Connection: closed
2019-04-15 10:00:53 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
now i am getting this error
Your mail server is out of spec — the AUTH capability line should be followed by a list of the authentication types it supports — but it doesn’t list any so you can’t authenticate. For example, here’s how gmail responds:
250-smtp.gmail.com at your service, [88.184.221.3]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Another strange thing is that I get different capabilities listed on your server — though it’s normal to require STARTTLS before allowing AUTH:
telnet rsixchange.ramco.com 25
Trying 14.141.0.163...
Connected to rsixchange.ramco.com.
Escape character is '^]'.
220 ramcomail1.ramco.com ESMTP
EHLO localhost
250-ramcomail1.ramco.com
250-8BITMIME
250-SIZE 104857600
250 STARTTLS
It might be worth trying port 587 instead of 25 in case they don’t accept message submission on port 25. Beyond that I suggest talking to your support services.
I have got some sample code
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Host = «smtp.live.com»;
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->Username = «MY USERNAME (hotmail)»;
$mail->Password = «MY PASSWORD (hotmail)»;
but i am not sure which php file i need to mention.. either in phpmailer.php or smtp.php
can you please suggest
I mean try this:
You should also set:
$mail>-SMTPSecure = 'tls';
i am sorry my doubt is where to write this code ?
Do i need to write the code in smtp.php ?
Hi marcus, in my server port number 25 only i am able to send and receive the messages.
this is my configuration settings that i got from the support services
and my error as follows :
2019-04-16 10:43:35 Connection: opening to rsixchange.ramco.com:25, timeout=300, options=array()
2019-04-16 10:43:35 Connection: opened
2019-04-16 10:43:35 SERVER -> CLIENT: 220 IMGEXWCNV01.rsimail.rsil.ramco.com Microsoft ESMTP MAIL Service ready at Tue, 16 Apr 2019 16:14:08 +0530
2019-04-16 10:43:35 CLIENT -> SERVER: EHLO learningsupport.ramco.com
2019-04-16 10:43:35 SERVER -> CLIENT: 250-IMGEXWCNV01.rsimail.rsil.ramco.com Hello [172.16.20.20]
250-SIZE 104857600
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-AUTH
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 XEXCH50
2019-04-16 10:43:35 SMTP Error: Could not authenticate.
2019-04-16 10:43:35 CLIENT -> SERVER: QUIT
2019-04-16 10:43:35 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
2019-04-16 10:43:35 Connection: closed
2019-04-16 10:43:35 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
In normal telnet i am able to send mail, through php i am able to send mail, through backend sql server i am able to send the DBmailer.
only through moodle i am not able to do it.
paru8889
changed the title
stream_socket_client(): unable to connect to rsixchange.ramco.com:25 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Still not able to send or receive mail in moodle
Apr 16, 2019
As I said, their server response is broken. You could try disabling authentication, with SMTPAuth = false
.
thanks for the reply sir. Now i am getting the below error.
2019-04-20 15:05:48 Connection: opening to rsixchange.ramco.com:25, timeout=300, options=array()
2019-04-20 15:05:48 Connection: opened
2019-04-20 15:05:48 SERVER -> CLIENT: 220 IMGEXWCNV01.rsimail.rsil.ramco.com Microsoft ESMTP MAIL Service ready at Sat, 20 Apr 2019 20:36:30 +0530
2019-04-20 15:05:48 CLIENT -> SERVER: EHLO learningsupport.ramco.com
2019-04-20 15:05:48 SERVER -> CLIENT: 250-IMGEXWCNV01.rsimail.rsil.ramco.com Hello [172.16.20.20]
250-SIZE 104857600
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-AUTH
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 XEXCH50
2019-04-20 15:05:48 CLIENT -> SERVER: STARTTLS
2019-04-20 15:05:48 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2019-04-20 15:06:04 Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed [D:moodlelibphpmailersrcSMTP.php line 403]
2019-04-20 15:06:04 SMTP Error: Could not connect to SMTP host.
2019-04-20 15:06:04 CLIENT -> SERVER: QUIT
2019-04-20 15:06:04 SERVER -> CLIENT:
2019-04-20 15:06:04 SMTP ERROR: QUIT command failed:
2019-04-20 15:06:04 Connection: closed
2019-04-20 15:06:04 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Can you please help me in this.. i have updated the certificate and mentioned in my php.ini file
openssl cafile/curl info but still i am getting this error
You need to figure out why the verification is failing. This is likely to be one of 3 things:
- The name on the certificate (what the server says in response to EHLO) does not match the name in your
Host
property. - The certificate has expired.
- You don’t have a matching CA certificate in your operating system’s certificate store.
The first of these you can check just by comparing the names. The other two you can check using the openssl s_client
commands shown in the troubleshooting guide.
thanks for the response.. do i need to generate the certificate in the name of my host i.e either server IP address or in the system name or the host i mentioned learningsupport.ramco.com
The name of the server you’re connecting from doesn’t matter, nor does this have anything to do with your own site’s certificate – it’s all about the name of the mail server you’re connecting to, and unless that’s your own mail server, you probably don’t have much control over that.
Thanks for the support my smtp mailer is working
23rd June 2011, 11:41 PM #1
- Rep Power
- 0
Hallo there
I have been trying to find out how to set my email in Moodle 2. I am new to Moodle I like it very much and how you can make the quizzes and courses.
My problem is when a student creates account it says message failed.
Under Server and email I have set it like this.
smtp hosts: smtp.dsl.telkomsa.net
username: online2212355
Password: for email: ******Everytime I create account for a new user pretending to be student to test the email it says message failed cannot send.
Why is this?
Thank you
Regards
Cheryl
24th June 2011, 12:19 AM #2
1. smtp.dsl.telkomsa.net host, is this your or your ISP’s
2. Have you allowed moddle to relay off this host?
3. Does it require authentication and is the authentication type correct?
4. Check the logs on smtp.dsl.telkomsa.net and see what SMTP logs are saying.Sukh
26th June 2011, 12:23 AM #3
- Rep Power
- 0
smtp error in moodle email problem
Originally Posted by sukh
1. smtp.dsl.telkomsa.net host, is this your or your ISP’s
2. Have you allowed moddle to relay off this host?
3. Does it require authentication and is the authentication type correct?
4. Check the logs on smtp.dsl.telkomsa.net and see what SMTP logs are saying.Sukh
Thank you so much for your reply I appreciate it. I am new to this but I cannot get the email sorted out yet.
Yes my smtp is smtp.dls.telkomsa.net
What do you mean about allowing moodle to relay off this host. Could you walk me through the steps please.
where do I check the logs on smtp.dsl.telkomsa.net and see what smtp logs are saying.do I have to change anything in php mailer
Internet_E-mail_Settings-2011-06-26_00.18.30.png
Internet_E-mail_Settings-2011-06-26_00.18.54.pngScreenshot-2011-06-26_00.01.21.png
Thank you again for helping me.
Last edited 26th June 2011 at 12:26 AM.
26th June 2011, 01:05 AM #4
1. The 1st & 2nd picture is of Outlook.
2. The 3rd seems to be of moodle.
3. smtp.dsl.telkomsa.net — Is this a windows server with SMTP service running? IS it an exch server? Is it a unix server?
4. Is smtp.dsl.telkomsa.net working from other applications or for Outlook if it’s used for this.
5. I got no idea what smtp.dsl.telkomsa.net this is so I cant say where to look for logs, if you reply to point3 I may be able to help.
6. Has this ever worked? Or is it 1st time you trying to get it to work?Some info on moodle but this is straight forward. — Email settings — MoodleDocs
26th June 2011, 03:57 PM #5
- Rep Power
- 0
email problems
Originally Posted by sukh
1. The 1st & 2nd picture is of Outlook.
2. The 3rd seems to be of moodle.
3. smtp.dsl.telkomsa.net — Is this a windows server with SMTP service running? IS it an exch server? Is it a unix server?
4. Is smtp.dsl.telkomsa.net working from other applications or for Outlook if it’s used for this.
5. I got no idea what smtp.dsl.telkomsa.net this is so I cant say where to look for logs, if you reply to point3 I may be able to help.
6. Has this ever worked? Or is it 1st time you trying to get it to work?Some info on moodle but this is straight forward. — Email settings — MoodleDocsHallo there
The system I am using is windows xp sp2. The email works fine in microsoft outlook I do not use microsoft exchange. With these email settings I sent you.
I sent you a screenshot of moodle to show you what I had typed in there for…smtp which is also used for the outlook email, which is smtp.dsl.telkomsa.net
and my pop3 is pop3.telkomsa.net.
What must i put in moodle 2.03 for email to work or how should I go about it?
I am running moodle for windows as a localhost from pc. Yes it is the first time I am trying to set up moodle any help would be appreciated.
Thank you
26th June 2011, 04:15 PM #6
1. In moodle you should put in the smtp.dsl.telkomsa.net for the relay
2. It seems like youre using POSTFIX and the SMTP on Windows XP SP2, if this is the case, you need to make sure either the IP address of the moodle systems is allowed to relay using smtp.dsl.telkomsa.net or setup a username/password which postfix will expect so that a system is allowed to rely.
3. As a test, from the PC running moodle try the below and see if this work.Open cmd.exe
Then Type Telnet smtp.dsl.telkomsa.net 25
Helo smtp.dsl.telkomsa.net 25
mail from:youremail@yourdomainname.com
rcpt to:youremail@yourdomainname.com
Data. (then hit return).
Subject:Test (. then hit return).for ref : XFOR: Telnet to Port 25 to Test SMTP Communication
See if you get the message. You may want to disabled any AV or firewall you have on the moodle PC to test this as it gets stopped. If you cant event telnet to the host then configure your SMTP to allow the moodle OS to connect.
26th June 2011, 09:28 PM #7
- Rep Power
- 0
Originally Posted by sukh
1. In moodle you should put in the smtp.dsl.telkomsa.net for the relay
2. It seems like youre using POSTFIX and the SMTP on Windows XP SP2, if this is the case, you need to make sure either the IP address of the moodle systems is allowed to relay using smtp.dsl.telkomsa.net or setup a username/password which postfix will expect so that a system is allowed to rely.
3. As a test, from the PC running moodle try the below and see if this work.Open cmd.exe
Then Type Telnet smtp.dsl.telkomsa.net 25
Helo smtp.dsl.telkomsa.net 25
mail from:youremail@yourdomainname.com
rcpt to:youremail@yourdomainname.com
Data. (then hit return).
Subject:Test (. then hit return).for ref : XFOR: Telnet to Port 25 to Test SMTP Communication
See if you get the message. You may want to disabled any AV or firewall you have on the moodle PC to test this as it gets stopped. If you cant event telnet to the host then configure your SMTP to allow the moodle OS to connect.
I tried the telnet commands and this is a screenshot of what I got.
I also set Moodle to smtp.dsl.telkomsa.net
telnet.GIFWhat else do I need to do.
I tried again to set up account pretending to be a student in Moodle on the login screen and itsaid
SMTP Error: Could not authenticate. ERROR: SMTP Error: Could not authenticate.
SMTP server error: 5.5.2 Error: command not recognizedThank you
Cheryl
Last edited 26th June 2011 at 09:35 PM.
26th June 2011, 09:40 PM #8
Try again, but just type:
data
Then hit return (you typed «data.» i.e. with a period/dot on the end).
26th June 2011, 09:54 PM #9
- Rep Power
- 0
Originally Posted by PiqueABoo
Try again, but just type:
data
Then hit return (you typed «data.» i.e. with a period/dot on the end).
Hi there
I realised I had done something wrong so this is now what I did and the replies I got back.
220 rrba-ip-smtp-2-3.saix.net ESMTP Postfix
Helo smtp.dsl.telkomsa.net 25
250 rrba-ip-smtp-2-3.saix.net
mail from:cherylj1@telkomsa.net
250 2.1.0 Ok
rcpt to: cherylj1@telkomsa.net
250 2.1.5 Ok
Data
354 End data with <CR><LF>.<CR><LF>
Subject:Test
.
This is a test message you will not see a response from this command.
.
250 2.0.0 Ok: queued as A69101F63
27th June 2011, 11:19 AM #10
Did you get the test message?
27th June 2011, 04:10 PM #11
- Rep Power
- 0
No it did not show anything in my email or in cmd
27th June 2011, 04:20 PM #12
The message has been accepted and queued, do you see anything on your smtp.dsl.telkomsa.net host?
ARe y o sure the message isnt in your junk email?
smtp.dsl.telkomsa.net — Is this working for any other application?
27th June 2011, 05:11 PM #13
- Rep Power
- 0
Originally Posted by sukh
The message has been accepted and queued, do you see anything on your smtp.dsl.telkomsa.net host?
ARe y o sure the message isnt in your junk email?
smtp.dsl.telkomsa.net — Is this working for any other application?
After Subject:Test I press Enter nothing happend. waited a while then I checked the junk mail box nothing there. This email does work with no problem I can send and receive normal emails with attachments but when I do it through telnet it does not want to work and in moodle it does not want to work..
Thanks again
Regards Cheryl
27th June 2011, 05:23 PM #14
What you need to do is check the SMTP logs on smtp.dsl.telkomsa.net and see what’s going on. The message seems to have been accepted but it isnt getting delivered.
Can you check the queues on the smtp.dsl.telkomsa.net host and see if you can see the messages?
27th June 2011, 05:52 PM #15
- Rep Power
- 0
How do I check the queues or smtp logs what do I do to do that?
I’m using PHPMailer in a Simple Script For Send Email’s Through Gmail, and I’m getting an «Unknown Error» (At least for me!):
SMTP Error: Could not authenticate.
Error: SMTP Error: Could not
authenticate.SMTP server error: 5.7.1 Username and
Password not accepted. Learn more at
535 5.7.1
http://mail.google.com/support/bin/answer.py?answer=14257
p38sm2467302ybk.16
I’ve read about Configure OpenSSL For SSL/TLS Connections, and I did it. Apache And PHP Are properly-Configured (With OpenSSL extension Running in PHP and mod_ssl running in Apache 2.2.16).
This is The PHP Script:
<?php
require_once ("PHPMailerclass.phpmailer.php");
$Correo = new PHPMailer();
$Correo->IsSMTP();
$Correo->SMTPAuth = true;
$Correo->SMTPSecure = "tls";
$Correo->Host = "smtp.gmail.com";
$Correo->Port = 587;
$Correo->UserName = "foo@gmail.com";
$Correo->Password = "gmailpassword";
$Correo->SetFrom('foo@gmail.com','De Yo');
$Correo->FromName = "From";
$Correo->AddAddress("bar@hotmail.com");
$Correo->Subject = "Prueba con PHPMailer";
$Correo->Body = "<H3>Bienvenido! Esto Funciona!</H3>";
$Correo->IsHTML (true);
if (!$Correo->Send())
{
echo "Error: $Correo->ErrorInfo";
}
else
{
echo "Message Sent!";
}
?>
The Username and Password are OK, And I tried in Thunderbird, without any problem.
I’ve also Used SSL Authentication and Port 465, getting the same Error.
Cœur
36.4k25 gold badges191 silver badges259 bronze badges
asked Oct 16, 2010 at 16:57
2
I encountered this problem. To get it working, I had to go to myaccount.google.com -> «Sign-in & security» -> «Apps with account access», and turn «Allow less secure apps» to «ON» (near the bottom of the page).
Alternatively you can follow this direct link to these settings
Joundill
6,42211 gold badges35 silver badges50 bronze badges
answered Sep 4, 2015 at 14:56
7
Try this instead :
$Correo->Username = «foo@gmail.com»;
I tested it and its working perfectly without no other change
answered Oct 16, 2010 at 17:19
malletjomalletjo
1,78616 silver badges18 bronze badges
2
I received the same error and in mycase it was the password. My password has special characters.
If you supply the password without escaping the special characters the error will persist.
E.g $mail->Password = " por$ch3";
is valid but will not work using the code above .
The solution should be as follows: $mail->Password = "por$ch3";
Note the Backslash I placed before the dollar character within my password.
That should work if you have a password using special characters
answered Aug 1, 2012 at 9:57
BubbaBubba
1011 silver badge7 bronze badges
2
Because Allow less secure apps is no longer available
The solution was to enable 2-step verification and generate app password
select mail and computer from the list then click generate
copy the code shown in the box and replace your google password with your app password it works like a charm.
answered Jun 28, 2022 at 2:10
Kym NTKym NT
6309 silver badges28 bronze badges
1
I experienced the same error when configuring the WP-Mail-SMTP
plugin in WordPress.
The problem would persist even when I have ‘triple checked’ the settings and login credentials, and am able to log in manually using a browser.
There’s a list of steps you can take to fix this.
- Create a new password for the Gmail account you want to use
- Enable less secure apps in Google Security settings
- Use the
Display Unlock Captcha
page to give your app or website permission to sign in to Gmail. ClickContinue
or follow the instructions. - Sign in using the app or website. The smtp settings that work for me are 1) SMTP Host: smtp.gmail.com 2) SMTP port: 587 3) Encryption: TLS 4) Authentication: SMTP authentication 5) Username: example@gmail.com 6) Password: examplesecret
Greg
20.9k17 gold badges81 silver badges106 bronze badges
answered Jul 20, 2017 at 8:24
pyforkpyfork
3,5972 gold badges20 silver badges18 bronze badges
1
my solution is:
- change gmail password
- on gmail «Manage your google Account» > Security > Turn on 3rd party app Access
- This the new step that i discover by UnlockingCaptcha that told in this site, the exact site is https://accounts.google.com/b/0/DisplayUnlockCaptcha, but maybe you want to read the former site first.
That all, hope it works for you
answered Jul 15, 2020 at 15:37
1
I received this error because of percentage signs in the password.
answered Dec 5, 2011 at 13:22
svandragtsvandragt
1,61320 silver badges37 bronze badges
1
For me I had a special characters in my password field, and I put it like $mail->Password = » por$ch3″ which work for gmail smpt server but not for other; so I just changed double quotes to single quotes and it works for me. $mail->Password = ‘ por$ch3’;
answered Jun 11, 2013 at 12:17
3
If you still face error in sending email, with the same error message. Try this:
$mail->SMTPSecure = 'tls';
$mail->Host = 'smtp.gmail.com';
just Before the line:
$send = $mail->Send();
or in other sense, before calling the Send() Function.
Tested and Working.
answered Jun 11, 2014 at 19:30
JackSparrowJackSparrow
9081 gold badge11 silver badges8 bronze badges
1
The other post is correct to resolve the issue but doesn’t address how to do it if the 2-step-verification is turned on. The option to allow the less secure apps is NOT available then. Here is an answer to how to do it:
a. Go to the URL of `https://myaccount.google.com/` and click `Sing-in and security`
b. Click on the app password.
You will reach a page like this,
c. Create name of your app and generate a password for the respective app.
d. Use that password acquired here inside the app.
This should resolve the issue.
answered May 20, 2018 at 10:16
ArefeArefe
10.4k16 gold badges101 silver badges159 bronze badges
0
I had the same issue and did all the tips including Gmail setting (e.g. less secure apps access) with no luck. But finally when I changed password to something different, for some reason it worked! FYI, the initial password did not have any special characters.
answered May 24, 2016 at 22:57
EhsanEhsan
1,02211 silver badges20 bronze badges
- first go to https://myaccount.google.com
- Select Security tab
- Scroll down and select ‘Less secure app access’
- Turn on access
This will solve my “SMTP Error: Could not authenticate” in PHPMailer error.
answered Apr 29, 2020 at 13:07
ruwanmadhusankaruwanmadhusanka
7812 gold badges7 silver badges15 bronze badges
I had the same issue and did all the tips with no luck. Finally when I changed password to something different, for some reason it worked! (the initial password or the new one did not have any special characters)
answered Aug 18, 2019 at 14:06
0
The correct answer:
Go to «Manage your google accounts => Security => Signing in to Google => App passwords».
Generate your maill account password there (that will be used from other device)
answered Apr 13, 2022 at 9:49
I had the same problem with authentication. The fix was to set up 2-step verification and create an application specific password for the device ( error messages for blocking the device will appear in your account settings->»Notifications and alerts» if you problem is the same with mine)
answered Jan 29, 2015 at 21:35
It was the selinux issue. I just updated the below given part in /etc/selinux/config file
SELINUX=permissive
(it was SELINUX=enforcing before).
then just reboot the system by giving
reboot
Now the mail goes without any hassle.
Configuration
From Email Address : [noreply@yourdomain.com]
From Name : [your domain name]
SMTP Host : smtp.gmail.com
Type of Encryption : SSL
SMTP Port : 465
SMTP Authentication : YES
Username : [your mail id]
Password : [your password]
answered Feb 10, 2016 at 7:17
SMTP Error: could not authenticate
I had the same problem. The following troubleshooting steps helped me.
- I turned off two-factor authentication in my gmail account.
- I allowed less secure apps to access my gmail account. To get it working, I had to go to
myaccount.google.com
->Sign-in & security
->Apps with account access
, and turnAllow less secure apps
toON
(near the bottom of the page). - At this step, when I tried to register a user, I would get the same error. Google would sent me a warning message that someone has my password and the login was blocked.
- Gmail will then provide you with options. You either click whether the activity was yours or not yours. Click the option that the activity was yours.
- Try registration again. It should now work.
cSteusloff
2,4376 gold badges27 silver badges50 bronze badges
answered Dec 14, 2017 at 11:47
There is no issue with your code.
Follow below two simple steps to send emails from phpmailer.
You have to disable 2-step verification setting for google account if you have enabled.
Turn ON allow access to less secure app.
answered Apr 12, 2018 at 7:24
За последние 24 часа нас посетили 11395 программистов и 1116 роботов. Сейчас ищут 316 программистов …
-
VaneS
Активный пользователь- С нами с:
- 16 ноя 2011
- Сообщения:
- 631
- Симпатии:
- 3
- Адрес:
- Россия
Здравствуйте, у меня при отправке по SMTP выводится ошибка:
-
SMTP Error: Could not authenticate.
Как это исправить?
-
Команда форума
Модератор- С нами с:
- 15 мар 2007
- Сообщения:
- 9.901
- Симпатии:
- 968
правильно авторизоваться на smtp-сервере. русским по белому написано что? ошибка смтп: не смог аутентифицироваться
-
VaneS
Активный пользователь- С нами с:
- 16 ноя 2011
- Сообщения:
- 631
- Симпатии:
- 3
- Адрес:
- Россия
Почему с локального сервера все работает, а с удаленной VPS выдает эту ошибку? Ранее все работало, а на этой неделе просто перестал отправлять письма
-
Команда форума
Модератор- С нами с:
- 15 мар 2007
- Сообщения:
- 9.901
- Симпатии:
- 968
мб настройки смтп сменили?
-
VaneS
Активный пользователь- С нами с:
- 16 ноя 2011
- Сообщения:
- 631
- Симпатии:
- 3
- Адрес:
- Россия
Да в том и дело что ничего не меняли. Пытался подключаться к майлу и яндексу, ошибка оставалась прежняя, хотя ранее все работало нормально.
-
Предположение: у хостера обновили ssl, php-ssl — нет.
-
VaneS
Активный пользователь- С нами с:
- 16 ноя 2011
- Сообщения:
- 631
- Симпатии:
- 3
- Адрес:
- Россия
-
Попробуй поиграть с безопасностью транспорта:
$mail->SMTPSecure = ‘tls’;
или
$mail->SMTPSecure = ‘ssl’;Добавлено спустя 2 минуты 28 секунд:
я понимаю, но вы обновляли openSSL после небезызвестного бага?
-
Команда форума
Модератор- С нами с:
- 15 мар 2007
- Сообщения:
- 9.901
- Симпатии:
- 968
-
VaneS
Активный пользователь- С нами с:
- 16 ноя 2011
- Сообщения:
- 631
- Симпатии:
- 3
- Адрес:
- Россия
Кажется нет, а как это сделать?
Добавлено спустя 9 минут 53 секунды:
Моя CMS использует phpmailer, нашел там строку и заменил настройку, все заработало, спасибо большое!!!
Так все же, как обновить на сервере SSL? -
Команда форума
Модератор- С нами с:
- 15 мар 2007
- Сообщения:
- 9.901
- Симпатии:
- 968
руками из исходников скомпилировать. ну это если хорошо знаете что это. иначе дождитесь когда ментейнеры обновят rpm в репах центоса.
-
Там, чуть ли не в одних из первых появляется.
yum check-update
прочитает базу и выплюнет длинный список того, что давненько не обновлялось.
далее 2 пути:
1) обновить 1 openssl: yum update openssl
2) обновить все: yum update