Reputation: 732
I want to send email via my desktop app
Here is my code
MailMessage m = new MailMessage("[email protected]", "[email protected]", "subject", "body");
m.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("out.tedata.net.eg");
smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "password");
smtp.UseDefaultCredentials = true;
smtp.Send(m);
My problem is: this code throw an exception
Transaction failed. The server response was: 5.7.1 <[email protected]>: Relay access denied
I think because my internet provider need outgoing server (SMTP) authentication
I config it in Outlook as below
Now, How can I config it in my code
Thanks
Upvotes: 1
Views: 8833
Reputation: 541
It can be various issues:
Hope this help you.
Upvotes: 0
Reputation: 31
I found this question because I have the same problem. I solved it using the myNetworks entry in /etc/postfix/main.cf Add the IP from which your sending to the myNetworks line, I think PostFix expects a space to separate IP adresses, for my eyes it's better to use a comma, but if I use both it works.
This solution is not ideal, so I'll be gratefull for a better one!
Rob
Upvotes: 0