Solved

Sending emails with asp.net

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

772 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