XF 1.1 Xenforo mailing via SMTP doesn't work

zenforoo

Member
Have tried various ports, etc. SSH'd into server and manually sent mail with telnet using desired server and user/pass. Have tried alternative SMTP servers. I just can't seem to get SMTP to work with Xenforo.

From Server Error Logs:

Code:
Server Error Log
Error Info
Zend_Mail_Protocol_Exception: Incorrect authentication data - library/Zend/Mail/Protocol/Abstract.php:431
Generated By: Unknown Account, Today at 2:59 AM
Stack Trace
#0 /home/XXXXX/public_html/library/Zend/Mail/Protocol/Smtp/Auth/Login.php(95): Zend_Mail_Protocol_Abstract->_expect(235)
#1 /home/XXXXX/public_html/library/Zend/Mail/Protocol/Smtp.php(217): Zend_Mail_Protocol_Smtp_Auth_Login->auth()
#2 /home/XXXXX/public_html/library/Zend/Mail/Transport/Smtp.php(200): Zend_Mail_Protocol_Smtp->helo('localhost')
#3 /home/XXXXX/public_html/library/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
#4 /home/XXXXX/public_html/library/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#5 /home/XXXXX/public_html/library/XenForo/Mail.php(177): Zend_Mail->send()
#6 /home/XXXXX/public_html/library/XenForo/Mail.php(152): XenForo_Mail->sendMail(Object(Zend_Mail))
#7 /home/XXXXX/public_html/library/XenForo/Model/UserConfirmation.php(136): XenForo_Mail->send('XXXXX...', 'testaccount')
#8 /home/XXXXX/public_html/library/XenForo/ControllerPublic/Register.php(328): XenForo_Model_UserConfirmation->sendEmailConfirmation(Array)
#9 /home/XXXXX/public_html/library/Tac/CustomImgCaptcha/ControllerPublic/Register.php(51): XenForo_ControllerPublic_Register->actionRegister()
#10 /home/XXXXX/public_html/library/XenForo/FrontController.php(313): Tac_CustomImgCaptcha_ControllerPublic_Register->actionRegister()
#11 /home/XXXXX/public_html/library/XenForo/FrontController.php(132): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#12 /home/XXXXX/public_html/index.php(13): XenForo_FrontController->run()
#13 {main}
Request State
array(3) {
  ["url"] => string(41) "http://XXXXX.com/register/register"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(10) {
  ["username"] => string(11) "testaccount"
  ["email"] => string(28) "XXXXXX@XXXXXX.com"
  ["password"] => string(8) "********"
  ["password_confirm"] => string(8) "********"
  ["timezone"] => string(16) "America/New_York"
  ["public_uuid"] => string(25) "4d974114cff451fa074502f88"
  ["agree"] => string(1) "1"
  ["_xfToken"] => string(8) "********"
  ["reg_key"] => string(32) "636e45718149cfdce806c46bf2f8a22e"
  }
}
 
You can see the error is:

Check the username and password.

That would be my first guess as well, but I've copied and pasted to no avail. Neither PostmarkApp nor SendGrid work, provided with the correct username and password (triple-checked).

VPS is able to send SMTP mail using my name and password. Just not through Xenforo....

Code:
root@server2 [~]# telnet smtp.sendgrid.net 25
Trying 50.97.69.146...
Connected to smtp.sendgrid.net.
Escape character is '^]'.
220 mi21 ESMTP service ready
EHLO
250-192.210.195.215
250-8BITMIME
250-SIZE 20480000
250-AUTH=PLAIN LOGIN
250-AUTH PLAIN LOGIN
250 STARTTLS
auth login
334 VXNlcm5hbWU6
XXXXX
334 UGFzc3dvcmQ6
XXXXX
235 Authentication successful.
mail from: XXXXX@XXXXX.com
250 Sender address accepted
rcpt to: XXXXX@XXXXX.com
250 Recipient address accepted
data
354 Continue
To:To Name
From: From Name
Subject:Testing

This is the body of the message you would like to send.
.
250 Delivery in progress
quit
221 See you later
Connection closed by foreign host.

So if SendGrid works, my VPS is able to connect and send mail through it, that would to me indicate that Xenforo is the issue.
 
It's worth noting that the error message itself is actually coming from the SMTP server. So it's connecting to something.

Can you screenshot your SMTP setup details? You can blur out the username (and password) if you want.
 
It's worth noting that the error message itself is actually coming from the SMTP server. So it's connecting to something.

Can you screenshot your SMTP setup details? You can blur out the username (and password) if you want.

Screen Shot 2013-08-01 at 5.54.55 PM.webp

It may or may not be worth nothing that I've used this setup successfully with other applications on the same server.
 
Your telnet example shows TLS but you haven't enabled that in XF. Looking at this example: http://sendgrid.com/docs/Integrate/Frameworks/zend.html

You will want to enable TLS and try port 587 to be consistent with their docs.

Sendgrid supports plain connections on ports 25, 2525, and 587. They support TLS on 25, 2525, and 587. They support SSL over 465.

I have tried all 7 of these combinations. None successfully.

It's not a Sendgrid specific issue, either. As I mentioned previously I have tried alternatives - PostmarkApp, Gmail, etc. No SMTP server works. Any port, any provider.
 
I'm not totally sure what to suggest then. We have plenty of people using Gmail, for example, without issue. Mail sending is actually handled by Zend Framework, and Sendgrid has an example using that so I don't think that's the issue, but I don't see why it would fail if the direct telnet worked as they should be using the same network stack. It's acting like all SMTP is being forced through a particular SMTP server but that's usually only done on consumer connections (and telnet should show it).

I suppose they could be using a different network stack if there were outgoing iptables filters based on the UID of the process or something similar?
 
I'm not totally sure what to suggest then. We have plenty of people using Gmail, for example, without issue. Mail sending is actually handled by Zend Framework, and Sendgrid has an example using that so I don't think that's the issue, but I don't see why it would fail if the direct telnet worked as they should be using the same network stack. It's acting like all SMTP is being forced through a particular SMTP server but that's usually only done on consumer connections (and telnet should show it).

I suppose they could be using a different network stack if there were outgoing iptables filters based on the UID of the process or something similar?

I doubt that's the case. Other applications on the server (Wordpress, vBulletin, IPB) have all been successfully set up to use an external SMTP to send mail. And it's always been as easy as inputting the server, port and credentials.
 
I know this is very old, but I thought I would help anyone else landing here. Most panels (like WHM / Cpanel) have in depth configs.

WHM has a setting that restricts SMTP mailing to certain accounts. (root, MTA, mailman)

"This feature prevents users from bypassing the mail server to send mail, a common practice used by spammers.
It will allow only the MTA, mailman, and root to connect to remote SMTP servers."

Disabling this works in cases where you are getting this error and are on Cpanel.
 
@thewebco -- I just wanted to thank you. Your recommendation of disabling SMTP Restrictions within WHM solved this problem for me on not only XenForo but also IPBoard, both of which I host and had been routing email to SparkPost from.

I'd gladly buy you a beer should our paths ever cross. Your post solved a week's worth of beating my head against the desk.

Cheers!
 
Top Bottom