question

SaeidHamzehee avatar image
SaeidHamzehee asked

How Can I Send Email to others

I'm trying to send and Email to somebody, but I faced to problem. Actually I'm working with C# .Net and my code body is here as follows: using System.Net; using System.Net.Mail; SmtpClient SMTPClientObj = new SmtpClient(); SMTPClientObj.UseDefaultCredentials = false; SMTPClientObj.Credentials = new NetworkCredential(" admin@Domain.com", "Admin password"); SMTPClientObj.Host = "Mail.inno-tech.com"; SMTPClientObj.Port = 587; SMTPClientObj.EnableSsl = true; SMTPClientObj.Send(" admin@Domain.com", " somebodyEmail@yahoo.com", "test", "this is test") I faced to "Server does not support secure connections" problem. when I used this code SmtpClient smtpClient = new SmtpClient(); NetworkCredential basicCredential =new NetworkCredential("admin", "admin Password", "Mail.inno - tech.com"); MailMessage message = new MailMessage(); MailAddress fromAddress = new MailAddress(" sam@yahoo.com"); smtpClient.Host = "Mail.inno-tech.com"; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = basicCredential; message.From = fromAddress; message.Subject = "your subject"; message.IsBodyHtml = true; message.Body = "

your message body

"; message.To.Add(" David@gmail.com"); try { smtpClient.Send(message); } catch (Exception ex) { MessageBox.Show(ex.Message); } I faced to this problem "Mailbox unavailable. The server response was: No such user here" . It seems that David@gmail.com in not valid for Host address(Mail.inno - tech.com). As a matter of fact, my problem is I can not send an Email from all mail boxes to all any other mail boxes. I just can send an Email from all mail boxes to Email addresses which are valid for my host address(Mail.inno - tech.com). I wonder whether I should set some setting as a configuration setting in which I define for Host to accept all mail addresses as a receiver or there is other solution to solve it. In advance I really appreciate you for your help.
visual-studio-2008
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
ThomasRushton avatar image
ThomasRushton answered
First off, this is a SQL Server Q&A site, not a C# programming Q&A site... You're best off trying those chaps over at [StackOverflow][1]. Having said that, it's possible that you (or your email admin guy) just have to set up mail relaying for your SMTP server. You'll need to set up appropriate delivery paths for non-local mail from other sources. [1]: http://www.stackoverflow.com
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.