473,385 Members | 1,720 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,385 software developers and data experts.

New ASP.NET 2.0 Mail Question

I am converting one of my ASP.NET 1.1 apps over to 2.0 and I see that the
old way of sending mail will still work, but I want to make it clean and
convert over to the new way of doing things. You used to be able to specify
CC and BCC recipients and now I can't figure out how to specify these.

I am using the following when converting:

Dim MailObj as New System.Net.Mail.SmtpClient
MailObj.Host = "myhost"
MailObj.Send(From.Text, To.Text, Subj.Text, Msg.Text)

So how do I specify CC and BCC for this?

Thanks in advance!
Dec 14 '05 #1
5 1313
You still need to use MailMessage if you want to add CC and BCC recipients.
The Send method also works with a MailMessage object.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"David Hearn" <da*********@stagparkway.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
I am converting one of my ASP.NET 1.1 apps over to 2.0 and I see that the
old way of sending mail will still work, but I want to make it clean and
convert over to the new way of doing things. You used to be able to specify
CC and BCC recipients and now I can't figure out how to specify these.

I am using the following when converting:

Dim MailObj as New System.Net.Mail.SmtpClient
MailObj.Host = "myhost"
MailObj.Send(From.Text, To.Text, Subj.Text, Msg.Text)

So how do I specify CC and BCC for this?

Thanks in advance!

Dec 14 '05 #2
Thanks Christopher!

"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
You still need to use MailMessage if you want to add CC and BCC
recipients. The Send method also works with a MailMessage object.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"David Hearn" <da*********@stagparkway.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
I am converting one of my ASP.NET 1.1 apps over to 2.0 and I see that the
old way of sending mail will still work, but I want to make it clean and
convert over to the new way of doing things. You used to be able to
specify CC and BCC recipients and now I can't figure out how to specify
these.

I am using the following when converting:

Dim MailObj as New System.Net.Mail.SmtpClient
MailObj.Host = "myhost"
MailObj.Send(From.Text, To.Text, Subj.Text, Msg.Text)

So how do I specify CC and BCC for this?

Thanks in advance!


Dec 14 '05 #3
See :
http://weblogs.asp.net/scottgu/archi...10/432854.aspx

Although Scott's article doesn't mention BCC, its usage is identical to CC.

See :

http://66.129.71.130/QuickStartv20/u...ystem.Net.Mail
for the classes available in System.Net.Mail

and

http://66.129.71.130/QuickStartv20/u...ss=MailMessage

For the methods available in System.Net.Mail.MailMessage

Juan T. Llibre
ASP.NET MVP
============
"David Hearn" <da*********@stagparkway.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
I am converting one of my ASP.NET 1.1 apps over to 2.0 and I see that the old way of sending mail
will still work, but I want to make it clean and convert over to the new way of doing things. You
used to be able to specify CC and BCC recipients and now I can't figure out how to specify these.

I am using the following when converting:

Dim MailObj as New System.Net.Mail.SmtpClient
MailObj.Host = "myhost"
MailObj.Send(From.Text, To.Text, Subj.Text, Msg.Text)

So how do I specify CC and BCC for this?

Thanks in advance!

Dec 14 '05 #4
Hi David,

you may try something like this -

MailMessage msg = new MailMessage();
SmtpClient server = new SmtpClient();
msg.From = new MailAddress("xy*@xyz.com", "DisplayName");
msg.To.Add("xy*@xyz.com");
msg.CC.Add("xy*@xyz.com, ab*@xyz.com");
msg.Bcc.Add("xy*@xyz.com, ab*@xyz.com, cd*@de.ca");
msg.Subject = "Subject";
msg.Body = "Message Body";
msg.IsBodyHtml = true;
server.Host = "mailserver";
server.UseDefaultCredentials = true;
server.Send(msg);

HTH.

Kaustav Neogy.

"David Hearn" wrote:
I am converting one of my ASP.NET 1.1 apps over to 2.0 and I see that the
old way of sending mail will still work, but I want to make it clean and
convert over to the new way of doing things. You used to be able to specify
CC and BCC recipients and now I can't figure out how to specify these.

I am using the following when converting:

Dim MailObj as New System.Net.Mail.SmtpClient
MailObj.Host = "myhost"
MailObj.Send(From.Text, To.Text, Subj.Text, Msg.Text)

So how do I specify CC and BCC for this?

Thanks in advance!

Dec 14 '05 #5

"David Hearn" <da*********@stagparkway.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
I am converting one of my ASP.NET 1.1 apps over to 2.0 and I see that the
old way of sending mail will still work, but I want to make it clean and
convert over to the new way of doing things. You used to be able to specify
CC and BCC recipients and now I can't figure out how to specify these.

I am using the following when converting:

Dim MailObj as New System.Net.Mail.SmtpClient
MailObj.Host = "myhost"
MailObj.Send(From.Text, To.Text, Subj.Text, Msg.Text)

So how do I specify CC and BCC for this?

Thanks in advance!

Dec 14 '05 #6

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

Similar topics

5
by: Rick | last post by:
Is there a way to use these two types of coding in the Mail function of PHP? Thanks for any help you can give it is most appreciated!! money_format('%i', $total) and print " <tr...
13
by: Ammar | last post by:
OK guys, Thanks to your help, I could finally send ASP mails with attachements... A very strange question: When I looked through all the sites you gave me and through Google, I got the impression...
2
by: Fabricio Sperandio | last post by:
Hi everyone, I am using the Mail Class to send an E-mail. It works very well but I would like show my name instead of the E-mail on the mail client, when the user receives the E-mail. Now I...
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...
2
by: Bob | last post by:
In 2003 you could use system.web.mail to send e-mails as long as IIS server was installed on the computer, you would be able to send e-mail fairly easily. Since this has been made obsolete and MS...
9
by: shror | last post by:
hi every body, i have a problem which is when i was checking my mail() form it work fine but the problem is that the form configuration is not set correctly, in details: the from var is not...
3
by: Dudely | last post by:
I'm trying to debug someone else's third party code that I'm trying to install on my site. It works for him on his site, but not for me on "my" site. I've traced the problem to the mail() call....
1
by: =?Utf-8?B?VGltb3RoeQ==?= | last post by:
Hi all, who can help me , recently i found a problem from the window mail whic are i am using my own personal mail account and try to using window mail to log in. anywhre i can receive some of...
14
by: Jeff | last post by:
I'm writing my php "form mail" script. Does mail do any checking for header injection in the "to" and "subject" parameters? CR and/or LF? It seems to me it easily could and should, but does it?...
4
borisding
by: borisding | last post by:
Hi there, Well, I really need help from someone here, and hope that someone will answer my question and solve my problem. I know it's very common question and being asked by many developers: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.