473,399 Members | 3,106 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,399 software developers and data experts.

SMTP (System.Web.Mail??)

Hi,

I am using the Smtp component that comes with the .Net framework. I wanted
to know how can I set the Diaplay name of the user when sendind the message?
e.g. "Mustafa" <mr****@mymail.com>
when i send a message i revice the email in the From but i want to diaplay
both the Display name and the email address.

Thanks
Mustafa
Nov 16 '05 #1
6 1111
JMW
I dont remember the exact format but it is something like this (you see it in web-mail) "Bill Gates [bg****@microsoft.com].

jason.

"Mustafa Rabie" wrote:
Hi,

I am using the Smtp component that comes with the .Net framework. I wanted
to know how can I set the Diaplay name of the user when sendind the message?
e.g. "Mustafa" <mr****@mymail.com>
when i send a message i revice the email in the From but i want to diaplay
both the Display name and the email address.

Thanks
Mustafa

Nov 16 '05 #2
i tried that but no luck

any ideas?

thanks

"JMW" <JM*@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
I dont remember the exact format but it is something like this (you see it in web-mail) "Bill Gates [bg****@microsoft.com].
jason.

"Mustafa Rabie" wrote:
Hi,

I am using the Smtp component that comes with the .Net framework. I wanted to know how can I set the Diaplay name of the user when sendind the message? e.g. "Mustafa" <mr****@mymail.com>
when i send a message i revice the email in the From but i want to diaplay both the Display name and the email address.

Thanks
Mustafa

Nov 16 '05 #3
Hi,

I'm fairly sure I've had success using

Ross Jones < ro**@myaddress.com >

HTH.
"Mustafa Rabie" <mr*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
i tried that but no luck

any ideas?

thanks

"JMW" <JM*@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
I dont remember the exact format but it is something like this (you see it
in web-mail) "Bill Gates [bg****@microsoft.com].

jason.

"Mustafa Rabie" wrote:
Hi,

I am using the Smtp component that comes with the .Net framework. I

wanted to know how can I set the Diaplay name of the user when sendind the message? e.g. "Mustafa" <mr****@mymail.com>
when i send a message i revice the email in the From but i want to diaplay both the Display name and the email address.

Thanks
Mustafa


Nov 16 '05 #4
Hi Ross,

i tried that again and nuthing, the display name is not showing

i used
cmailMessage.To = "Mustafa Rabie <mr****@mydomain.com>" //where cmailMessage
is the message class

can you check if that's the same syntax u used?

thanks

"Ross Jones" <ro**@community.nospam> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
Hi,

I'm fairly sure I've had success using

Ross Jones < ro**@myaddress.com >

HTH.
"Mustafa Rabie" <mr*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
i tried that but no luck

any ideas?

thanks

"JMW" <JM*@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
I dont remember the exact format but it is something like this (you
see it
in web-mail) "Bill Gates [bg****@microsoft.com].

jason.

"Mustafa Rabie" wrote:

> Hi,
>
> I am using the Smtp component that comes with the .Net framework. I

wanted
> to know how can I set the Diaplay name of the user when sendind the

message?
> e.g. "Mustafa" <mr****@mymail.com>
> when i send a message i revice the email in the From but i want to

diaplay
> both the Display name and the email address.
>
> Thanks
> Mustafa
>
>
>



Nov 16 '05 #5
Mustafa,

Here's the code I used to send the message..

class MailTest
{
[STAThread]
static void Main(string[] args)
{
MailMessage msg = new MailMessage();
msg.From = "Ross Jones <ross@mydomain>";
msg.To = "Ross Jones <ross@mydomain>";
msg.Subject = "Email test";
msg.BodyFormat = MailFormat.Text;
msg.Body = "This is my email test";
SmtpMail.SmtpServer = "customermail.easily.co.uk";
SmtpMail.Send( msg );
Console.WriteLine( " Message sent " );
}
}

The email comes through in Outlook as
Ross Jones [ross@mydomain]

The actual header looks like
From: "Ross Jones" <ro**@teamknowledge.co.uk>

If you like I could try out your code on my mail server to see what it does,
if you could trim the code down to the bare minimum.

Ross.

"Mustafa Rabie" <mr*******@hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP11.phx.gbl...
Hi Ross,

i tried that again and nuthing, the display name is not showing

i used
cmailMessage.To = "Mustafa Rabie <mr****@mydomain.com>" //where cmailMessage is the message class

can you check if that's the same syntax u used?

thanks

"Ross Jones" <ro**@community.nospam> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
Hi,

I'm fairly sure I've had success using

Ross Jones < ro**@myaddress.com >

HTH.
"Mustafa Rabie" <mr*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
i tried that but no luck

any ideas?

thanks

"JMW" <JM*@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
> I dont remember the exact format but it is something like this (you

see
it
in web-mail) "Bill Gates [bg****@microsoft.com].
>
> jason.
>
> "Mustafa Rabie" wrote:
>
> > Hi,
> >
> > I am using the Smtp component that comes with the .Net framework. I wanted
> > to know how can I set the Diaplay name of the user when sendind the message?
> > e.g. "Mustafa" <mr****@mymail.com>
> > when i send a message i revice the email in the From but i want to
diaplay
> > both the Display name and the email address.
> >
> > Thanks
> > Mustafa
> >
> >
> >



Nov 16 '05 #6
hi Ross,

Thanks for the code, i tried it out and still i am not getting except the
email?
here's my code that sends the message. If you want me to send you the whole
app, it's very small btw tell me where to email you the zip file.

Thanks a lot for your help really appreciate it :)
public bool SendMessage(string szTO, string szCC, string szBCC, string
szFrom, string szSubject, string szBody)

{

bool fRet = false;

if ((szTO != "") && (szFrom != ""))

{

cmailMsg.To = "Mustafa Rabie <mrabie@mrabie-w2k3>";

cmailMsg.Cc = szCC;

cmailMsg.Bcc = szBCC;

cmailMsg.From = szFrom;

cmailMsg.Subject = szSubject;

cmailMsg.Body = szBody;

try

{

SmtpMail.SmtpServer = "localhost";
//System.Configuration.ConfigurationSettings.AppSett ings["pop3Host"];

SmtpMail.Send(cmailMsg);

fRet = true;

}

catch(Exception exp)

{

fRet = false;

}

}

else

{

fRet = false;

}

return fRet;

}

"Ross Jones" <ro**@community.nospam> wrote in message
news:#g**************@TK2MSFTNGP11.phx.gbl...
Mustafa,

Here's the code I used to send the message..

class MailTest
{
[STAThread]
static void Main(string[] args)
{
MailMessage msg = new MailMessage();
msg.From = "Ross Jones <ross@mydomain>";
msg.To = "Ross Jones <ross@mydomain>";
msg.Subject = "Email test";
msg.BodyFormat = MailFormat.Text;
msg.Body = "This is my email test";
SmtpMail.SmtpServer = "customermail.easily.co.uk";
SmtpMail.Send( msg );
Console.WriteLine( " Message sent " );
}
}

The email comes through in Outlook as
Ross Jones [ross@mydomain]

The actual header looks like
From: "Ross Jones" <ro**@teamknowledge.co.uk>

If you like I could try out your code on my mail server to see what it does, if you could trim the code down to the bare minimum.

Ross.

"Mustafa Rabie" <mr*******@hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP11.phx.gbl...
Hi Ross,

i tried that again and nuthing, the display name is not showing

i used
cmailMessage.To = "Mustafa Rabie <mr****@mydomain.com>" //where cmailMessage
is the message class

can you check if that's the same syntax u used?

thanks

"Ross Jones" <ro**@community.nospam> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
Hi,

I'm fairly sure I've had success using

Ross Jones < ro**@myaddress.com >

HTH.
"Mustafa Rabie" <mr*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> i tried that but no luck
>
> any ideas?
>
> thanks
>
> "JMW" <JM*@discussions.microsoft.com> wrote in message
> news:9F**********************************@microsof t.com...
> > I dont remember the exact format but it is something like this (you
see
it
> in web-mail) "Bill Gates [bg****@microsoft.com].
> >
> > jason.
> >
> > "Mustafa Rabie" wrote:
> >
> > > Hi,
> > >
> > > I am using the Smtp component that comes with the .Net
framework. I > wanted
> > > to know how can I set the Diaplay name of the user when sendind the > message?
> > > e.g. "Mustafa" <mr****@mymail.com>
> > > when i send a message i revice the email in the From but i want

to > diaplay
> > > both the Display name and the email address.
> > >
> > > Thanks
> > > Mustafa
> > >
> > >
> > >
>
>



Nov 16 '05 #7

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

Similar topics

8
by: Sue | last post by:
Does this "NT-based machine (NT, 2K, XP)" mean a WindowsXP machine is a NT-based machine? What does NT stand for and what does it mean? What is CDONTS? What does this mean - "The machine...
3
by: dale zhang | last post by:
Hi, I write an asp.net web application. It has a “Contact Us” page, where users fill in their email, subject and text and hit send. Then the email will go to my hard coded yahoo email...
6
by: Brian M | last post by:
I have an ASP.NET application using .NET Framework 1.1 running on a Windows 2003 server. The application uses SMTP to send emails. This application was moved from an IIS 5 machine where it worked...
3
by: RN | last post by:
I am tired of sending mail from the built-in SMTP service for so many reasons (errors are nondescriptive in the event log, it doesn't let me control which IP address it sends from, and it...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
5
by: Chris | last post by:
I am trying to send email in C#. I wrote 2 pieces of code: 1. MailMessage mail = new MailMessage(); mail.From = "from_address"; mail.To = "to_address"; mail.Subject = "subject"; mail.BodyFormat...
2
by: daokfella | last post by:
I'm having trouble using localhost to test the e-mail functions in my application. I keep getting the following error when sending mail: "Unable to read data from the transport connection: An...
2
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used,...
7
by: Rob Dob | last post by:
The following code is giving me a timeout problem., no matter what I do I can't send a piece of mail using .net2.0 System.Net.Mail.SmtpClient via port 465 and using ssl, if however I try using...
1
by: tshad | last post by:
I have a W2K3 Server we are setting up to run a Windows Service for a client at their location. I don't want this machine to go through exchange or their local mail server, I just want the...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.