473,729 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Email Programming using System.Web.Mail

I have been able using the namespace System.Web.Mail and its method
Smtp.mail.send to mail simple text messages to a small group within
our 55 and older community. I need help expanding the programs
capabilities. Searching this forum I did not find any related
information so if I have chosen poorly, I would appreciate a
suggestion of a more appropriate dotnet forum.

Now what I wish is the ability to send bcc's rather than to: (would be
sending to all 250 residents and would have to send in groups of 50 as
required by Comcast to curtail spammers) and also wonder if this
namespace handles base64 encoding so that I can send a pdf attachment.
Appreciate,

Ed


Jan 16 '08 #1
11 3508
Well, the first step would be rather to check the doc rather than to find a
suitable group ;-)

Try :
http://msdn2.microsoft.com/en-us/lib...e_members.aspx
(you'll find BCC).

By browsing to attchments you'll see :
http://msdn2.microsoft.com/en-us/lib...t_members.aspx
for the Encoding property.

Note that this is 1.1 It is obsolete in 2.0 (see System.Net.Mail ).

--
Patrice

"Ed Bitzer" <ed******@yahoo .coma écrit dans le message de news:
u0************* @TK2MSFTNGP06.p hx.gbl...
>I have been able using the namespace System.Web.Mail and its method
Smtp.mail.send to mail simple text messages to a small group within
our 55 and older community. I need help expanding the programs
capabilities. Searching this forum I did not find any related
information so if I have chosen poorly, I would appreciate a
suggestion of a more appropriate dotnet forum.

Now what I wish is the ability to send bcc's rather than to: (would be
sending to all 250 residents and would have to send in groups of 50 as
required by Comcast to curtail spammers) and also wonder if this
namespace handles base64 encoding so that I can send a pdf attachment.
Appreciate,

Ed


Jan 16 '08 #2
On Jan 16, 12:19 pm, "Ed Bitzer" <edbit...@yahoo .comwrote:
I have been able using the namespace System.Web.Mail and its method
Smtp.mail.send to mail simple text messages to a small group within
our 55 and older community. I need help expanding the programs
capabilities. Searching this forum I did not find any related
information so if I have chosen poorly, I would appreciate a
suggestion of a more appropriate dotnet forum.

Now what I wish is the ability to send bcc's rather than to: (would be
sending to all 250 residents and would have to send in groups of 50 as
required by Comcast to curtail spammers) and also wonder if this
namespace handles base64 encoding so that I can send a pdf attachment.
Appreciate,

Ed
Though it might not help with encoding (not sure) two excellent sites
you need to check out are:

http://www.systemwebmail.com/

And

http://www.systemnetmail.com/

IMO if you are using 2.0 or higher you should be using System.Net.Mail

Thanks,

Seth Rowe [MVP]
Jan 16 '08 #3
Ed,

This is how I attach files to eMails sent via System.Net.Mail :
Private Sub AddAttachment(B yRef message As MailMessage, ByVal sFile As
String)
Dim attFile As Attachment
Dim disposition As ContentDisposit ion

attFile = New Attachment(sFil e)
disposition = attFile.Content Disposition
disposition.Cre ationDate = System.IO.File. GetCreationTime (sFile)
disposition.Mod ificationDate =
System.IO.File. GetLastWriteTim e(sFile)
disposition.Rea dDate = System.IO.File. GetLastAccessTi me(sFile)
message.Attachm ents.Add(attFil e)
End Sub

The MailMessage object does have a Bcc property, so you can add Bcc adresses
(don't know how many):
Dim adrBcc As MailAddress

adrBcc = New MailAddress("ad **@your.com")
message.Bcc.Add (adrBcc)

adrBcc = New MailAddress("ad **@your.com")
message.Bcc.Add (adrBcc)
...

Hope this helps,
Thomas
"Ed Bitzer" <ed******@yahoo .comschrieb im Newsbeitrag
news:u0******** *****@TK2MSFTNG P06.phx.gbl...
>I have been able using the namespace System.Web.Mail and its method
Smtp.mail.send to mail simple text messages to a small group within
our 55 and older community. I need help expanding the programs
capabilities. Searching this forum I did not find any related
information so if I have chosen poorly, I would appreciate a
suggestion of a more appropriate dotnet forum.

Now what I wish is the ability to send bcc's rather than to: (would be
sending to all 250 residents and would have to send in groups of 50 as
required by Comcast to curtail spammers) and also wonder if this
namespace handles base64 encoding so that I can send a pdf attachment.
Appreciate,

Ed



Jan 16 '08 #4
I should have emphasized:
I'm using System.Net.Mail instead of System.Web.Mail (NET 2.0)
The types I'm using (MailMessage, Attachment) are part of that namespace.

"Thomas Weise" <th****@data-download.deschr ieb im Newsbeitrag
news:O2******** ******@TK2MSFTN GP06.phx.gbl...
Ed,

This is how I attach files to eMails sent via System.Net.Mail :
Private Sub AddAttachment(B yRef message As MailMessage, ByVal sFile As
String)
Dim attFile As Attachment
Dim disposition As ContentDisposit ion

attFile = New Attachment(sFil e)
disposition = attFile.Content Disposition
disposition.Cre ationDate = System.IO.File. GetCreationTime (sFile)
disposition.Mod ificationDate =
System.IO.File. GetLastWriteTim e(sFile)
disposition.Rea dDate = System.IO.File. GetLastAccessTi me(sFile)
message.Attachm ents.Add(attFil e)
End Sub

The MailMessage object does have a Bcc property, so you can add Bcc
adresses (don't know how many):
Dim adrBcc As MailAddress

adrBcc = New MailAddress("ad **@your.com")
message.Bcc.Add (adrBcc)

adrBcc = New MailAddress("ad **@your.com")
message.Bcc.Add (adrBcc)
...

Hope this helps,
Thomas
"Ed Bitzer" <ed******@yahoo .comschrieb im Newsbeitrag
news:u0******** *****@TK2MSFTNG P06.phx.gbl...
>>I have been able using the namespace System.Web.Mail and its method
Smtp.mail.se nd to mail simple text messages to a small group within
our 55 and older community. I need help expanding the programs
capabilities . Searching this forum I did not find any related
information so if I have chosen poorly, I would appreciate a
suggestion of a more appropriate dotnet forum.

Now what I wish is the ability to send bcc's rather than to: (would be
sending to all 250 residents and would have to send in groups of 50 as
required by Comcast to curtail spammers) and also wonder if this
namespace handles base64 encoding so that I can send a pdf attachment.
Appreciate,

Ed





Jan 16 '08 #5

"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:d3******** *************** ***********@x69 g2000hsx.google groups.com...
On Jan 16, 12:19 pm, "Ed Bitzer" <edbit...@yahoo .comwrote:
>I have been able using the namespace System.Web.Mail and its method
Smtp.mail.se nd to mail simple text messages to a small group within
our 55 and older community. I need help expanding the programs
capabilities . Searching this forum I did not find any related
information so if I have chosen poorly, I would appreciate a
suggestion of a more appropriate dotnet forum.

Now what I wish is the ability to send bcc's rather than to: (would
be
sending to all 250 residents and would have to send in groups of 50
as
required by Comcast to curtail spammers) and also wonder if this
namespace handles base64 encoding so that I can send a pdf
attachment.
Appreciate,

Ed

Though it might not help with encoding (not sure) two excellent
sites
you need to check out are:

http://www.systemwebmail.com/

And

http://www.systemnetmail.com/

IMO if you are using 2.0 or higher you should be using
System.Net.Mail

Thanks,

Seth Rowe [MVP]

Seith and Patrice too,

I have waded my way through all the references gave and digested
sufficiently to create a prototype that sends an email To: somebody,
with Bcc's to several others and can handle one or more pdf
attachments encoded with Base64 - and it works<g>. Obviously you guys
gave me excellent directions. I do have one more questions and that
is how is this stuff getting to the recipients. I am sending from my
home. I am providing system.web.mail with no information about my
ISP. Does my program act as a Server and do its own thing looking up
the DNS information for each of the recipients ISP's? When I use
commercial software such as Thunderbird or OE I must spell out the
smtp servicer and provide a username and password.

Ed
Jan 16 '08 #6

"Thomas Weise" <th****@data-download.dewrot e in message
news:e6******** ******@TK2MSFTN GP04.phx.gbl...
>I should have emphasized:
I'm using System.Net.Mail instead of System.Web.Mail (NET 2.0)
The types I'm using (MailMessage, Attachment) are part of that
namespace.
Thomas,

The syntax is quite different than my older version of VB.Net (203)
where I am using System.Net.Mail (but of course requires the same
information); however, I was successful as you may have noticed in the
note I just wrote to Seth and Patrice. I asked them how this was
getting out of my home computer because I know if we send to our 250
or so residence in this 55 and older community (and we are sending out
announcements daily) we must send them to less than 100 addresses per
connection. This is a limitation imposed by Comcast, our ISP, to
limit spam (I was going to say eliminate, but they certainly have not
figured out a solution there). If my mail program is being sent
through their server, I can easily fix the program so that it
connects, sends 100, disconnects, reconnects and sends another 100.
This is going to be a big time saver. Now I use to be the guy who
processed all the mail requests from our community but I recently
managed to pawn the job off on another retired guy. Maybe I can get a
free lunch out of this program<g>

Ed


Jan 16 '08 #7
I can understand the Comcast restriction, our group went thru this and
decided to simply buy into a service rather then coding and maintain it.
Sometimes using a service is better then spending time coding.

"Ed Bitzer" <ed******@yahoo .comwrote in message
news:u1******** ******@TK2MSFTN GP06.phx.gbl...
>
"Thomas Weise" <th****@data-download.dewrot e in message
news:e6******** ******@TK2MSFTN GP04.phx.gbl...
>>I should have emphasized:
I'm using System.Net.Mail instead of System.Web.Mail (NET 2.0)
The types I'm using (MailMessage, Attachment) are part of that namespace.

Thomas,

The syntax is quite different than my older version of VB.Net (203) where
I am using System.Net.Mail (but of course requires the same information);
however, I was successful as you may have noticed in the note I just wrote
to Seth and Patrice. I asked them how this was getting out of my home
computer because I know if we send to our 250 or so residence in this 55
and older community (and we are sending out announcements daily) we must
send them to less than 100 addresses per connection. This is a limitation
imposed by Comcast, our ISP, to limit spam (I was going to say eliminate,
but they certainly have not figured out a solution there). If my mail
program is being sent through their server, I can easily fix the program
so that it connects, sends 100, disconnects, reconnects and sends another
100. This is going to be a big time saver. Now I use to be the guy who
processed all the mail requests from our community but I recently managed
to pawn the job off on another retired guy. Maybe I can get a free lunch
out of this program<g>

Ed


Jan 16 '08 #8


"Kevin S Gallagher" <ke************ ***@state.or.us wrote in message
news:uZ******** ******@TK2MSFTN GP06.phx.gbl...
>I can understand the Comcast restriction, our group went thru this
and decided to simply buy into a service rather then coding and
maintain it. Sometimes using a service is better then spending time
coding.

"Ed Bitzer" <ed******@yahoo .comwrote in message
news:u1******** ******@TK2MSFTN GP06.phx.gbl...
>>
"Thomas Weise" <th****@data-download.dewrot e in message
news:e6******* *******@TK2MSFT NGP04.phx.gbl.. .
>>>I should have emphasized:
I'm using System.Net.Mail instead of System.Web.Mail (NET 2.0)
The types I'm using (MailMessage, Attachment) are part of that
namespace.

Thomas,

The syntax is quite different than my older version of VB.Net (203)
where I am using System.Net.Mail (but of course requires the same
information) ; however, I was successful as you may have noticed in
the note I just wrote to Seth and Patrice. I asked them how this
was getting out of my home computer because I know if we send to
our 250 or so residence in this 55 and older community (and we are
sending out announcements daily) we must send them to less than 100
addresses per connection. This is a limitation imposed by Comcast,
our ISP, to limit spam (I was going to say eliminate, but they
certainly have not figured out a solution there). If my mail
program is being sent through their server, I can easily fix the
program so that it connects, sends 100, disconnects, reconnects and
sends another 100. This is going to be a big time saver. Now I use
to be the guy who processed all the mail requests from our
community but I recently managed to pawn the job off on another
retired guy. Maybe I can get a free lunch out of this program<g>
>Ed

Kevin,

I am retired, this is my hobby and I already have the program working.
My question is outside the box of coding but how does my VB.Net
program actually send thee messages? I do not believe they are going
thru my Comcast SMTP account.

Ed
Jan 17 '08 #9
Time for everyone to get on the same page I think.

The first thing that you need to confirm is that you are, in fact, using an
instance of the System.Net.Mail .SmtpClient class to senn your emails.

If you're not then it's all back to square one.

If you are then it would be interesting to see how you instantiate the
instance.

'The book' says that if you do not supply a target 'host', either in the
constructor or by setting the Host property then the instance will use
whatever is specified in your application or machine configuration files.
(It will 'look' in the application configuration first but if that doesn't
specify the appropriate information then it will fall back to the machine
configuration file.) While it doesn't say so in so many words, it implies
that it doesn't 'look' anywhere else, therefore I would expect that, if you
don't specify it and it isn't specified in either of the configuration
files, an exception would be thrown when you call the Send method.

I have just confirmed this by using:

Dim _client As New SmtpClient

_client.Send(Ne w MailMessage("fr omaddress", "toaddress" , "Test", "Test"))

It results in an InvalidOperatio nException with the message 'The SMTP host
was not specified.'.

The moment I specify a valid server then it works:

Dim _client As New SmtpClient("ser ver")

_client.Send(Ne w MailMessage("fr omaddress", "toaddress" , "Test", "Test"))

If you are definitely NOT specifying a 'host' in your code then that means
that you MUST have a 'host' specified in one or more of your config files.
All it is now, is a matter of you looking to see what it is. I know of no
automatic mechanism that will put such information in the configuration
files (but that doesn't mean such a mechanism doesn't exist).
The SmtpClient class is, as it's name suggests, a 'client' object and not a
'server' object. It will only connect to an 'up-line' SMTP server. If the
recipient's 'mailbox' is not directly served by that server then the message
will be relayed on to the appropriate server.
"Ed Bitzer" <ed******@yahoo .comwrote in message
news:ev******** ******@TK2MSFTN GP06.phx.gbl...
>
"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:d3******** *************** ***********@x69 g2000hsx.google groups.com...
>On Jan 16, 12:19 pm, "Ed Bitzer" <edbit...@yahoo .comwrote:
>>I have been able using the namespace System.Web.Mail and its method
Smtp.mail.sen d to mail simple text messages to a small group within
our 55 and older community. I need help expanding the programs
capabilitie s. Searching this forum I did not find any related
information so if I have chosen poorly, I would appreciate a
suggestion of a more appropriate dotnet forum.

Now what I wish is the ability to send bcc's rather than to: (would be
sending to all 250 residents and would have to send in groups of 50 as
required by Comcast to curtail spammers) and also wonder if this
namespace handles base64 encoding so that I can send a pdf attachment.
Appreciate,

Ed

Though it might not help with encoding (not sure) two excellent sites
you need to check out are:

http://www.systemwebmail.com/

And

http://www.systemnetmail.com/

IMO if you are using 2.0 or higher you should be using System.Net.Mail

Thanks,

Seth Rowe [MVP]


Seith and Patrice too,

I have waded my way through all the references gave and digested
sufficiently to create a prototype that sends an email To: somebody, with
Bcc's to several others and can handle one or more pdf attachments encoded
with Base64 - and it works<g>. Obviously you guys gave me excellent
directions. I do have one more questions and that is how is this stuff
getting to the recipients. I am sending from my home. I am providing
system.web.mail with no information about my ISP. Does my program act as
a Server and do its own thing looking up the DNS information for each of
the recipients ISP's? When I use commercial software such as Thunderbird
or OE I must spell out the smtp servicer and provide a username and
password.

Ed

Jan 17 '08 #10

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

Similar topics

5
394
by: John | last post by:
Having a problem sending emails through vb.net. Our inhouse software automatically sends an email to the programming staff whenever an error is encountered. This code works just fine on machines that are windows 2000 based. We recently upgraded from Outlook 2000 to Outlook 2003, and it still works. We have one machine with XP service pack 1. It works fine there. This also was upgraded from outlook 200 to outlook 2003.
11
1856
by: tshad | last post by:
I have a W2003 server running my website and I am trying to set up my pages to send email using System.Web.Mail. I have pages running on this machine using CDONTS that work fine. I am using our exchange server to send the mail but am getting an "Unable to relay" message. But the "From" name is my email address, which is obviously on our exchange server, so there is no relay. The message I get back is:
6
2417
by: Eduardo Rosa | last post by:
Somebody knows how I queue email using .Net? thanks a lot
9
394
by: RitaK | last post by:
I'm new to windows programming using vb.net. I want to send a simple email from my app to register the software. What is the easiest way to do this without knowing what email program is on the users machine. Any pointers would be appreciated.
1
3194
by: oliu321 | last post by:
Hi, I am trying to write some codes to send emails through a SMTP server. I wrote a C++ version using pure socket programming and SMTP protocol, a VB version using CDO and a C# version using System.Net.Mail. Now all of them works great with any email account but hotmail. So here is the C# code: MailAddress from = new MailAddress("ZZZ@CCC.com", "XXX"); MailAddress to = new MailAddress("SSS@hotmail.com", "YYY");
8
7284
by: shapper | last post by:
Hello, I am trying to send an email using Asp.Net 2.0. I am getting the following error: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: No such user here at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify,
1
2624
by: Wells Wang | last post by:
Hi, Everybody: Sorry to bother you. I am trying to use the code below to send an email with asp.net2.0& win XP. But it failed. On my laptop I can use outlook2003 to send email. If you are avaiable, could you help me figure it out(or test it on you computer). I am looking forward to getting any feedback from you.I can be reached
2
2682
by: Allie | last post by:
Hi, all. I'm new to C# programming. I'm even newer to programming email capabilities into my code. What I need to do is create three (3) functions: * sendEmail, using a Mail object (which needs to be created) as a parameter * forgotPassword, using whatever arguments it needs -- uses sendEmail to send lost password to user * sendRegistrationInfo, using whatever arguments it needs -- uses
3
7241
by: anu b | last post by:
Hii I am using System.net.mail for sending email... i need to send a webpage with its html content as my email body .....for that i used mail.Isbodyhtml as true...but it is not working for me so pls help me....
0
9428
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9288
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9206
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9154
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3240
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2692
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.