Solved

Sending emails with asp.net

Posted on 2011-09-15
4
306 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 39

Accepted Solution

by:
Kyle Abrahams earned 300 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now