+1 vote

I have a domain interpublicadvertising.com

When i send a mail from this account, result says sent with:

result.Status == SendMessageStatus.Success // as true

which means sent. But when i open my inbox, mail isnt delivered. when i use other accounts such as gmail. it delivers.

I have used breakpoints to track my code. code looks fine.

Note: I once faced this same issue before i started using this library (Mail.dll). I was able to fix the issue using

SmtpClient mailSmtpClient = new SmtpClient(smtp);
mailSmtpClient.UseDefaultCredentials = false; //this line

How can i do same using Mail.dll? How can i set DefaultCredentials to false.
I have tried:

builder.setDefault = false

Didnt work!!!

by

1 Answer

0 votes
 
Best answer

Muilder.SetDefault property is a different thing entirely. It's about setting Mime-Version header, Date header and Message-ID header automatically.

Make sure that you are using authentication before you send your emails (smtp.UseBestLogin("user", "pass")).

Consider also turning on logging to see exact client server communication:
https://www.limilabs.com/blog/logging-in-mail-dll


[Edit]

OK, the log doesn't look correct at all, and I'm sure result.Status is not SendMessageStatus.Success.

It seems that your server doesn't understand NOTFIY parameter.

Don't set the Smtp.Configuration.DeliveryNotification property, unless your server reports DSN extension (SmtpExtension.DSN). You can use Smtp.SupportedExtensions() to get supported server extensions.

by (297k points)
selected by
it is smtp not Imap,
I am using Smtp.UseBestLogin("user", "pass")). its fine. it connects as expected. result says sent. When i check, its not delivered. is there a method in (Mail.dll) to set SmtpClient.UseDefaultCredentials = false?
Server response (Log file) looks fine as well:

Mail.dll: 11 17:20:58 3.0.15017.1203
Mail.dll: 11 17:20:58 Connecting to 'smtp.interpublicadvertising.com:587', SSL: False.
Mail.dll: 11 17:20:58 S: 220 Welcome to PINE SMTP server.
Mail.dll: 11 17:20:58 C: EHLO [192.168.2.14]
Mail.dll: 11 17:20:59 S: 250-pine.arvixe.com
Mail.dll: 11 17:20:59 S: 250-SIZE 100000000
Mail.dll: 11 17:20:59 S: 250 AUTH LOGIN
Mail.dll: 11 17:20:59 C: AUTH LOGIN
Mail.dll: 11 17:20:59 S: 334 VXNlcm5hbWU6
Mail.dll: 11 17:20:59 C: [anonymized]
Mail.dll: 11 17:20:59 S: 334 UGFzc3dvcmQ6
Mail.dll: 11 17:20:59 C: [anonymized]
Mail.dll: 11 17:20:59 S: 235 authenticated.
Mail.dll: 63 17:21:00 C: MAIL FROM:<ifeanyi@anonymized.com>
Mail.dll: 63 17:21:00 S: 250 OK
Mail.dll: 63 17:21:00 C: RCPT TO:<aclassgclass@anonymized.com> NOTIFY=FAILURE,DELAY
Mail.dll: 63 17:21:00 S: 550 Invalid syntax. Syntax should be RCPT TO:<userdomain>[crlf]
Mail.dll: 63 17:21:00 C: RSET
Mail.dll: 63 17:21:00 S: 250 OK
Mail.dll: 63 17:21:01 C: QUIT
Mail.dll: 63 17:21:01 S: 221 goodbye
My mistake, UseBestLogin is present on all clients. No, there is no such method as UseDefaultCredentials. In SmtpMail this method simply uses the credentials of currently logged-in user. You can skip the authentication phase (remove UseBestLogin) to achieve the same result.
Could the problem be from the receipt based on the log file line:

Mail.dll: 63 17:21:00 S: 550 Invalid syntax. Syntax should be RCPT TO:<userdomain>[crlf]
Yes, that is the cause. Don't set Smtp.DeliveryNotification property.
GREAT!!! Thanks. Works fine now!!. Does it mean the server does not support DeliveryNotification property? can i run a server test for feature support before using DeliveryNotification property. Or should i just do without such
The default setting (when server receives no NOTIFY parameter) required by RFC is NOTIFY=DELAY,FAILURE. Of course the server may ignore the standard, but most likely it follows it. You can use Smtp.SupportedExtensions() and check for SmtpExtension.DSN.
Yahoomail server does not support DSN? I ran an Smtp.SupportedExtensions() on my yahoo account. I could only see PIPELINING, AUTH, SIZE and "8" as supported features. No DSN? Does "8" stand for DSN? what is 8? I'm not surprised if my domain server does not support DSN but yahoo is shocking.
 
    var serversupport = smtp.SupportedExtensions();

    if (serversupport.Contains(SmtpExtension.DSN)){
        smtp.DeliveryNotification = DeliveryNotificationOptions.OnFailure
        | DeliveryNotificationOptions.Delay;
    }

Smtp.DeliveryNotification property does not throw an error on yahoomail account. I'm not sure what to do conditionally to run this code
It doesn't support DSN extension, which means you can't use NOTIFY. It doesn't meant that Yahoo is not sending DSN's on failure - I'm almost sure it is.

As I said before there's no need to specify NOTIFY=DELAY, FAILURE as it's a default setting.

"8" is a perfect example, that this server has issues. It's a part of "8 BITMIME":

S: 250-8 BITMIME

This is incorrect and should be: 8BITMIME (without space). 8BITMIME is defined in https://www.limilabs.com/mail/rfc/6152
...