Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29767

Access denied when sending a mail from C# programm

$
0
0

I'm developing a third-party add-on to run in a program called M-Files. The purpose of the add-on is to send a mail with the help of an SMTP server. I created a fake SMTP server in DevelMail.com just for testing. Testing the SMTP server from a browser works but when i run the code it gives me the following error.

Transaction failed. The server response was: 5.7.1 Client host rejected: Access denied


Here are the SMTP information:
Host: smtp.develmail.com
SMTP Port: 25
TLS/SSL Port: 465
STARTTLS Port : 587
Auth types: LOGIN, CRAM-MD5

Here is the code:

MailAddress adressFrom = new MailAddress("notification@mfiles.no", "M-Files Notification Add-on");
MailAddress adressTo = new MailAddress("majdnakhleh@live.no");
MailMessage message = new MailMessage(adressFrom, adressTo);

message.Subject = "M-Files Add-on running";
string htmlString = @"<html>
                    <body>
                    <p> Dear customer</p>
                    <p> This is a notification sent to you by using a mailadress written in a metadata property!.</p>
                    <p> Sincerely,<br>- M-Files</br></p>
                    </body>
                    </html>
                    ";
message.Body = htmlString;

SmtpClient client = new SmtpClient();
client.Host = "smtp.develmail.com";
client.Port = 587;
client.Credentials = new System.Net.NetworkCredential("myUserName", "myPassword");
client.EnableSsl = true;
client.Send(message);

Viewing all articles
Browse latest Browse all 29767

Trending Articles