Hello Param,
As for the send mail code, are you using the "Network" as the SmtpClient's
"SmtpDeliveryMethod" and have you tried supply a credential or use the
default credential. Also, when using Exchange server in a domain
environment, you should make sure you have permission to send mail as the
"From" address since exchange server will validate this at server-side.
In addition, as you mentioned it works when using another SMTP server, is
that SMTP server a normal SMTP relay server which also transfer message to
another exchange server? If possible you can also create a local
smtpserver through IIS which act as a relay server to the Exchange server
and send mail through this local SMTP server to see whether it works.
So far based on my experience, it is likely a server environment specific
issue. Here is a simple code snippet which works for sending mail to local
domain user through local network exchange server:
==========================
private void btnSend_Click(object sender, EventArgs e)
{
MailMessage msg = new
MailMessage("(e-mail address removed)","(e-mail address removed)");
msg.Subject = "Smtp Client Test Message";
msg.IsBodyHtml = true;
msg.Body = "<font size='30'>Hello World</font>";
SmtpClient sc = new SmtpClient("smtphost");
sc.DeliveryMethod = SmtpDeliveryMethod.Network;
sc.UseDefaultCredentials = true;
sc.Send(msg);
}
===========================
Please feel free to post here if you have any other finding or any other
questions on this.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.