I have used the following code to send mail from my web application using a gmail account. My question is, can i change the sender address to another address other than original sender(gmail) address? My code is as follows:
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(); System.Net.NetworkCredential cred = new System.Net.NetworkCredential("[email protected]", "*******");
Whatever i do is useless as i always receive mail from [email protected]
. Is it possible to change it?
I have changed to mail.From = new System.Net.Mail.MailAddress("[email protected]");
but i received the mail with the from address [email protected]
and not from the new "From" address. I think gmail smtp overwrites the from address with the original credential.
Change the Email Sender Name in OutlookGo to File and select Info. Select Account Settings > Account Settings. In the Account Settings dialog box, choose the email account you want to edit and select Change. In the Your name text box, enter the name you want to appear in the From line of your emails.
In the "Send mail as," click Add another email address. In the window that opens, enter the name you want recipients to view. Enter the email address alias you've set up for email forwarding. Confirm that "Treat as an alias" is marked, and click Next step.
This is the solution:
This works for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With