I am trying to send an email using the Net Library like this:
B4X:
Dim Mail As SMTP
Mail.Initialize(strSMTPServerAddress_, "25", strUserName_, strPassword_, "Email")
Mail.UseSSL = False
Mail.AuthMethod = Mail.AUTH_LOGIN
Mail.To.Add(strMailToAddress)
Mail.Subject = "test subject"
Mail.Body = "test message"
Mail.Sender = strSenderEmailAddress_
Mail.Send
Now sometimes it works fine and other times I get a bounce back email sent to me with the following error:
Diagnostic-Code: smtp; 554 5.4.7 [internal] exceeded max time without delivery
Any idea why it works some of the time and not ALL the time??
If I understood correctly, this error means that the target server rejected the mail or wasn't able to process it. It doesn't seem to be related to your code.
The odd thing is why does why my .Net code work fine every time to send a email using the same target server, but not the B4A email code?
We can then surely rule the server out as the issue?
Is there perhaps some kind of internal settings or something you could expose in the Net library to help solve this problem?
Surely I can't be the only one with this problem
Eureka!!! Gentlemen I found the problem!
It seems if I use the unqualified version of my Mail Server name, ie. 'mail.somedomain.co.za' as I was instead of the actual IP address then I get this problem!
My website was using the IP address of the server, hence it was working fine! I think it is because my username and the server name are very close??
Thanks guys I appreciate all the help, you pointed me in the right direction!
I have found that this error is usually caused by the "receiving server" (receipient's server) thinking the email is spam and is simply ignoring requests to receive emails to itself.
MANY, MANY factors effect if an email looks like spam.
One thing to check is to make sure BOTH the .MailFrom AND .Sender is the SAME email address that you used in your .net code - see this thread for more info:
I'm using NET lib 1.80 with B4a 9.00. I have the below code: SMTP.Initialize("mail.mydomain.com",222,"send@mydomain.com","123Pass","SMTP") SMTP.To.Add("support@mydomain.com") SMTP.HtmlBody = False SMTP.Body = EmailBody SMTP.Subject = EmailSubject SMTP.MailFrom = "sales@mydomain.com"...