Reputation: 13287
Trying to send email via ASP.NET (classic ASP on the server works fine) and getting the "Unable to send to all recipients." error. Mail server is setup on localhost, Windows 2003 server 64-bit.
Web Config is as follows:
<mailSettings>
<smtp from="[email protected]">
<network host="127.0.0.1" port="25" defaultCredentials="true" />
</smtp>
</mailSettings>
Code that generates:
MailMessage mm = new MailMessage();
mm.From = new MailAddress("[email protected]");
mm.To.Add(email);
mm.Bcc.Add("[email protected]");
mm.CC.Add("[email protected]");
mm.Subject = "Your ENGL" + course + "-" + section+ " RaiderWriter account";
mm.Body = sb.ToString();
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Send(mm);
Upvotes: 0
Views: 11141
Reputation: 415
In our case the reason was that the SMTP-Server refused messages sent by a machine with a specific IP-Address.
SMTP-Server was part of IIS and there was a list of IPs configured which were allowed to use this SMTP-Server. The client machine in question was not part of the list so we got "Unable to send to all recipients." (or "Senden an alle Empfänger nicht möglich." in german).
Sending from a "valid" client worked.
The error message from the SMTP-Server in this case was pretty misleading.
Upvotes: 0
Reputation: 51
that can be if: 1)the user or pass are wrong 2)not enable SSL 3)less secure app is not enable 4)you have not log in in server with this mail
Upvotes: 0
Reputation: 101
If you have more than one invalid/non-existent email address in your recipients, this error message might happen on some email server, and on our email server the case applies for those email addresses are no longer valid because the employees left the company. Please let me know if you find any other possible cause.
Upvotes: 0
Reputation: 1
i struggle a lot and found that there were issue with my Application Pool. I set defaultAPPPool
and my code worked.
Upvotes: -1