In Following article I will explain how to send email using Gmail SMTP Server in ASP.Net. To send email with Gmail SMTP Server, you will need to use an email address and password of a valid Gmail account and along with that you will need the Gmail SMTP Mail
Server settings.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
AFAIK it won't work. Technically speaking the mail is sent from the gmail account using your own mail account and GMail overrides "From" so that you can't forge mail that seems to originate directly from any address you want...
It is an additional info that can be used when a mail comes from an address but when the response should be sended back to some other mail address.
Edit: it's really a form with multiple fields? If you have just a body input field you could also use https://www.rapidtables.com/web/html/mailto.html (if public it's common to use js to prevent
spammers to collect your mail address straight from the html markup).
Member
53 Points
275 Posts
Send email
Feb 26, 2018 10:05 AM|qsoft_developer|LINK
Hi,
I am building a new website for my company. At the moment we are using static website and I would like to convert it all to ASP.NET.
I have designed a nice bootstrap form, however I am having trouble with the contact us form.
In my old website I userd asp and the following object:
Set Mail = Server.CreateObject("Persits.MailSender")
I tried implementing the following code:
https://www.codeproject.com/Tips/371417/Send-Mail-Contact-Form-using-ASP-NET-and-Csharp
However, I don't want to use a real 'from' email like this:
I just want to use the mail address that the viewer filled in the form, just I like I do now:
Mail.port = "25"
Mail.From = Request("email") ' From address
Mail.FromName = Request("first_name") & Request("last_name")' From Name
Is there a way to use the asp Persits.MailSender object with .net? Or maybe is there another simple solution?
Thanks
Star
8670 Points
2882 Posts
Re: Send email
Feb 27, 2018 06:39 AM|Cathy Zou|LINK
Hi anooshiravan
In Following article I will explain how to send email using Gmail SMTP Server in ASP.Net. To send email with Gmail SMTP Server, you will need to use an email address and password of a valid Gmail account and along with that you will need the Gmail SMTP Mail Server settings.
Related link:
https://www.aspsnippets.com/Articles/Send-email-using-Gmail-SMTP-Mail-Server-in-ASPNet.aspx
https://stackoverflow.com/a/18326814/9143922
Best regards
Cathy
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
All-Star
48570 Points
18082 Posts
Re: Send email
Jan 14, 2020 05:23 PM|PatriceSc|LINK
Hi,
And the old site was using Gmail as well ????
AFAIK it won't work. Technically speaking the mail is sent from the gmail account using your own mail account and GMail overrides "From" so that you can't forge mail that seems to originate directly from any address you want...
Using could perhaps work: https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.mailmessage.replytolist?view=netframework-4.8
It is an additional info that can be used when a mail comes from an address but when the response should be sended back to some other mail address.
Edit: it's really a form with multiple fields? If you have just a body input field you could also use https://www.rapidtables.com/web/html/mailto.html (if public it's common to use js to prevent spammers to collect your mail address straight from the html markup).