Solved

Sending emails with asp.net

Posted on 2011-09-15
4
312 Views
Last Modified: 2012-05-12
Hello all,

Im using the attached code code to send an email.

Please notice the line

Dim addrFrom As New System.Net.Mail.MailAddress("noreply@mywebsite.com")

It looks really bad when receiving a message from "noreply@mywebsite.com". My question is, how can I do for the user to receive the message from noreply@mywebsite.com but see something like "Mywebsite Support" as the name of the sender?

Thanks!
Dim msg As New System.Net.Mail.MailMessage
Dim smtp As New System.Net.Mail.SmtpClient
Dim addrFrom As New System.Net.Mail.MailAddress("noreply@mywebsite.com")
msg.From = addrFrom
msg.To.Add(RS(6))
msg.Subject = "New Appointment Request"
msg.Body = email
smtp.Host = "xx.xx.xx.xx"
smtp.Port = 25
smtp.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
smtp.Send(msg)
smtp.Dispose()

Open in new window

0
Comment
Question by:pvg1975
4 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 300 total points
ID: 36545012
c#:
            MailMessage x = new MailMessage();
            x.From = new MailAddress("a@a.com", "Test This");

VB:
   msg.From = new MailAddress("noreply@mywebsite.com", "Display Name")

0
 
LVL 19

Assisted Solution

by:Manoj Patil
Manoj Patil earned 200 total points
ID: 36545351
Dim myMessage As New MailMessage

    Dim addrFrom As MailAddress = New MailAddress("noreply@mywebsite.com", "Mywebsite Support")
    Dim myTo As MailAddress = New MailAddress("steve@contoso.com", "Steve Miller")

    myMessage.From = addrFrom 
    myMessage.To.Add(myTo)

Open in new window

0
 
LVL 7

Expert Comment

by:mr_nadger
ID: 36547777
rather than spoofing the from address, which will be picked up by some email hosts (which happened to me when writing an asp email system), try using the reply to option instead.
0
 

Author Closing Comment

by:pvg1975
ID: 36549368
Thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question