[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

how can i send an email to an exchange email in asp.net?

I have a feedback page. But i can not program to send a reply mail to an exchange email. Any one help me?
SmtpClient smtpClient = new SmtpClient();
            MailMessage message = new MailMessage();            
 
            try
            {
                MailAddress fromAddress = new MailAddress("acb@email.com");
                smtpClient.Host = "localhost";
                smtpClient.Port = 25;
                message.From = fromAddress;
                Email send to
                message.To.Add("def@def.com");//this is an exchange account
                message.Subject = txtTitle.Text;
                message.IsBodyHtml = false;
                message.Body = txtDescription.Text;
                smtpClient.Send(message);
          }
            catch (Exception ex)
            {
                
            }

Open in new window

0
cuongnd
Asked:
cuongnd
  • 2
  • 2
1 Solution
 
Richard LeeSoftware EnthusiastCommented:
do you get an exception? if so what are the details?
0
 
cuongndAuthor Commented:
No, I didn't get any exception. Thanks a lot.
0
 
Richard LeeSoftware EnthusiastCommented:
Firstly if the mail does not reach the destination it could be that the destination server has criteria for accepting mail.

Secondly, and what may be the answer is that you are catching the exception with an empty catch block. Remove the try / catch and see what happens.
0
 
cuongndAuthor Commented:
Hi, DaTribe
I think this error may be because the criteria of mail server. Thank you so much
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now