473,396 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SmtpMail Question

Evidently the SmtpMail class doesn't throw an exception when the SMTP server
returns an error? It just lets you happily think the email was sent when
actually it was rejected by the SMTP server. I found this out by having my
app connect to DevNull's Dummy SMTP server. Seems I was sending just the
@domain part of the "FROM" address. Correcting that got my emails going.

Now, how do I get the From to display a friendly name instead of my email
address? I tried several variations of setting MailMessage.From="My Program
<em***@domain.com>". But everything I tried got rejected by the SMTP server
unless I only used the email address itself. I'm thinking I need to add the
"From: My Program" and "Reply-To: em***@address.com" headers to the email
but I'm not sure how to do that.

Appreciate any help.

Thanks.
Nov 23 '05 #1
1 947
The correct form to get a friendly name showing up in the From field is:
Mail.From = "MyName <my****@mydomain.com>"
which it looks like is what you are doing so you might have another problem.

To add a reply-to header do this:
Mail.Headers.Add("reply-to", "my**************@myDomain.com")

Kevin

"Terry Olsen" <to******@hotmail.com> wrote in message
news:Op*************@TK2MSFTNGP15.phx.gbl...
Evidently the SmtpMail class doesn't throw an exception when the SMTP
server returns an error? It just lets you happily think the email was
sent when actually it was rejected by the SMTP server. I found this out
by having my app connect to DevNull's Dummy SMTP server. Seems I was
sending just the @domain part of the "FROM" address. Correcting that got
my emails going.

Now, how do I get the From to display a friendly name instead of my email
address? I tried several variations of setting MailMessage.From="My
Program <em***@domain.com>". But everything I tried got rejected by the
SMTP server unless I only used the email address itself. I'm thinking I
need to add the "From: My Program" and "Reply-To: em***@address.com"
headers to the email but I'm not sure how to do that.

Appreciate any help.

Thanks.

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jason | last post by:
Hi just a really quick simple question. Can you configure SmtpMail class in C# to use a different port? or does it have to be port 25? Thanks Jason
2
by: Leonard | last post by:
I am using SmtpMail on a couple of ASP.NET pages. When mail is sent to an address outside the domain I get the "Could not access 'CDO.Message' object." error message. I have looked in the...
6
by: Cameron Eckman | last post by:
I get various errors when I try to use email on the machine I have. XP professional. It works fine on another machine with NT 2000 server. Below is the code: 'BEGIN CODE Dim oMail As New...
2
by: Edward | last post by:
Hello, everybody, I tried to send Email out using ASP.NET, but failed, here is the code of sending: -------------------------------------------------------------------------------- Try...
1
by: Jens Øster | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send...
3
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send...
3
by: chuckdfoster | last post by:
When using this bit of code, it sends two emails most of the time. Sometimes it doesn't send two, but most of the time it does. I put the system time (Now) in the Subject and each email has a...
2
by: kmbarz | last post by:
I'm trying to expand my horizons here by working through an ASP.Net book. When I do the example that uses: Line 55: Mail.From = "feedback@graymad.com" Line 56: ...
3
by: aslantifosi | last post by:
hi all, My question is about that i use a smpt server which is running on a different machine from my webserver machine. And i can authenticate with a user and password. I use SmtpMail class. i...
19
by: zdrakec | last post by:
Hello all: Using an "Imports System.Web.Mail" clause at the head of my module, and after executing the following code: Dim msg As New MailMessage msg.From = sender msg.To = recipient...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.