Anyone Help Me Please.
How to send mail in c# using exchange server 2010 without NetworkCredential
Now, I'm coding in C# using SmtpClient But I don't use Email and Password in NetworkCredential
public static void SendMailTest(string toMailId, string ccMailId)
{
string SMTP_Server_var = SMTP_Server;
int SMTP_Port_var = Convert.ToInt32(SMTP_Port);
string fromMailId = SMTP_Login;
string fromMailPassword = SMTP_Password;
string mailnoreply = "no-reply@xxx.com";
MailMessage mailmsg = new MailMessage();
mailmsg.From = new MailAddress("xxx@xxx.com", SystemEmail);
string From = mailmsg.From.ToString();
mailmsg.To.Add(toMailId);
mailmsg.CC.Add(ccMailId);
mailmsg.Headers.Add("Reply-To", SystemEmail);
mailmsg.ReplyTo = new MailAddress(SystemEmail); //Set Reply To Complete
mailmsg.Subject = subject;
mailmsg.Body = body;
mailmsg.SubjectEncoding = System.Text.Encoding.Default;
SmtpClient objclient = new SmtpClient(SMTP_Server_var, SMTP_Port_var);
objclient.UseDefaultCredentials = true;
objclient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
objclient.Send(mailmsg);
}
In Above Code is Return Error :
Mailbox unavailable. the server response was: 5.7.1 client does not have permissions to send as this sender
When Send From C# Class, I used with Web Application
So I want to found Solution to Solve This Error
Thank You Very Much.