A
anjaliagarwal1
Guest
While sending mail using office 365 how can we set different from address. Basically the credentials I am giving are for office 365 account/username and from email address I am mentioning the different account. So this has to be same?
Below is my code so far:
testMessage msg = new MailMessage();
msg.To.Add(new MailAddress(txtemail.Text.Tostring(), "To Name"));
msg.From = new MailAddress("abc@abc.com", "From Name");
msg.Subject = "This is a test";
msg.Body = "Hello, this is a test email";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("userName", "PASS");
client.Port = 121;
client.Host = "smtp.office365.com";
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
I don't want the customers to see my abc@abc.com email address. Instead of that, I want them to see Test@test.com. How can I achieve this? They can reply to test@test.com. I don't want them to reply to abc@abc.com. I am not sure which settings should I change to do this?
Any help will be highly appreciated.
Continue reading...
Below is my code so far:
testMessage msg = new MailMessage();
msg.To.Add(new MailAddress(txtemail.Text.Tostring(), "To Name"));
msg.From = new MailAddress("abc@abc.com", "From Name");
msg.Subject = "This is a test";
msg.Body = "Hello, this is a test email";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("userName", "PASS");
client.Port = 121;
client.Host = "smtp.office365.com";
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
I don't want the customers to see my abc@abc.com email address. Instead of that, I want them to see Test@test.com. How can I achieve this? They can reply to test@test.com. I don't want them to reply to abc@abc.com. I am not sure which settings should I change to do this?
Any help will be highly appreciated.
Continue reading...