SSL Smtp with username,password: Authentication Failed and I don't understand why since the credentials are valid

0 votes
asked Dec 17, 2015 by mrblint (340 points)

I am trying two different third-party mail libraries, one of them Rebex, after having no success with System.Net.Mail trying to connect to Rackspace secure.emailsrvr.com with a username and password via SSL on port 465.

With the first third-party library, I am able to do so successfully and send an email. But with Rebex Secure Mail, I am getting an authentication failure using the same credentials. Does anything here look wrong? I check all the values in the debugger and they're all correct. SslMode is Implicit because the connection fails with Explicit. I have also tried Plain mode and Auto mode.

this.ServerName = "secure.emailsrvr.com";
this.ServerPort = 465;
this.UserName = "foo@xxxxxxx.com";
this.Encoding = new System.Text.UTF8Encoding();                    
this.Connect(this.ServerName, this.ServerPort, Rebex.Net.SslMode.Implicit);
this.Login(this.UserName, SMTPPassword, Rebex.Net.SmtpAuthentication.Login);
Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Dec 17, 2015 by Lukas Pokorny (100,170 points)
selected Dec 18, 2015 by mrblint
 
Best answer

Hello, none of the values look wrong, but this seems to be an instance of one of your class and we don't know what's going on inside it.

Could you please try running the following code (replace the username and password with actual values) and let us know whether it works? And if it doesn't, please send us the rebex-log.txt log file for analysis - we might then be able to tell what is going on.

var smtp = new Smtp();
smtp.LogWriter = new FileLogWriter("rebex-log.txt", LogLevel.Debug);
smtp.Connect("secure.emailsrvr.com", 465, SslMode.Implicit);
smtp.Encoding = new System.Text.UTF8Encoding();
smtp.Login("foo@xxxxxxx.com", "password", SmtpAuthentication.Login);

By the way, it's usually better to use SmtpAuthentication.Auto instead of SmtpAuthentication.Login because it automatically chooses from the list of supported methods. In this case, the server appears to support Login in addition to Plain.

commented Dec 17, 2015 by mrblint (340 points)
Thanks for the reply.   Your code snippet succeeded.  I have a log file. What is the best way to get it to you? Shall I paste it here or email it to you?
commented Dec 17, 2015 by Martin Vobr (12,940 points)
please send it to support@rebex.net
commented Dec 17, 2015 by Tomas Knopp (58,890 points)
Logs can either be posted here, or sent to support@rebex.net. But you have the Rebex.Net.Smtp working, so is there anything that still need to be clarified?
commented Dec 17, 2015 by Lukas Pokorny (100,170 points)
Thanks! If you don't mind copy&pasting the log here, please add it to your question. Otherwise, email it to support@rebex.net
commented Dec 18, 2015 by mrblint (340 points)
My class inherits from your Smtp class. Is that allowed?   

class MYREBEXMAILER : Rebex.Net.Smtp
commented Dec 18, 2015 by Tomas Knopp (58,890 points)
Inheriting from Rebex.Net.Smtp is possible and is not a problem. If your customSmtp does not work and the code by Lukas works, so could you send the log to us so that we can see what is going on and help you resolve it?
commented Dec 18, 2015 by mrblint (340 points)
I think something may be amiss with the username/password  I've been using for testing purposes this past week.  It is no longer working.   I have changed to a different username, and the code is now working, but I'm getting rejects/returns  as spam:

"Our system has detected that this   message is not RFC 5322 compliant. To reduce the amount of spam   sent to Gmail, 550-5.7.1 this message has been blocked.
Please review 550   5.7.1  RFC 5322 specifications for more information. e1si10578073igl.65 -    gsmtp (in reply to end of DATA command)". I will open up a separate question about how to make sure all the mail headers are in place when using Rebex.  Thanks for the help.
commented Feb 18, 2016 by Tomas Knopp (58,890 points)
I am wondering, were you able to solve this issue? i do not see any separate forum question.
...