MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.58k stars 623 forks source link

SMTPSession::checkAccount : errors with "email@invalid.com" #1960

Open ThePrincelle opened 1 year ago

ThePrincelle commented 1 year ago

Hi,

I use your library with my mail client, Mailspring, on MacOS and Linux, and it appears that the method used to check if the SMTP server is valid (SMTPSession::checkAccount), is trying to send an email at "email@invalid.com".

https://github.com/MailCore/mailcore2/blob/a23882b13a1028753d1bdaef795cfd91acd7be8c/src/core/smtp/MCSMTPSession.cpp#L680

The problem is that some SMTP servers are responding with an error because the domain "invalid.com" doesn't actually exists. This causes the checkAccount method to fail even though the connection with the server is working fine.

SMTP Last Response Code: 450
SMTP Last Response: 4.1.2 <email@invalid.com>: Recipient address rejected: Domain not found

Thanks in advance for your response. Maxime

derula commented 1 year ago

I'm a Mailspring user currently affected by this problem, and it's pretty unfortunate. No other email client I tried had this issue. Someone suggested for Mailspring to add an option to skip SMTP verification as a workaround, but that should be avoidable seeing how no other clients seem to face this problem.

I've seen email clients "verify" SMTP using the account's own email address - could that be an alternative here?

Roboroads commented 1 year ago

A fix for this was proivided in https://github.com/Foundry376/Mailspring-Sync/pull/6 - sending to the sender. This is how office does it as well.

r = mailsmtp_rcpt(mSmtp, MCUTF8(from->mailbox()));