473,508 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending Email in VB 2005

Hello,

I have an application in VB 2003 that uses System.Web that creates and sends
an email. I'm trying to turn this application into a Windows Service in VB
2005 and have discovered that System.Web.Mail is replaced by
System.Net.Mail, but it seems the "To" property is read only now? How do I
set this property so I can actually send the email?

Any direction would be greatly appreciated.

Thanks!
Rick
Mar 14 '07 #1
3 1038
Try

'// Setup the new message.

Dim Message As New MailMessage("To", "From", "Subject", "Message")

'// Set the server to receive the smtp, exchange server or remote smtp
server

Dim EmailClient As New SmtpClient("DNS or IP")

'// If authentication is require it's set here.

' Dim SMTPUserInfo As New System.Net.NetworkCredential("Username",
"Password")

'// Defined by the above process, but doesn't seem to make much difference
is authentication is not required.

EmailClient.UseDefaultCredentials = False

'// If UserInfo is required this also need to be un-remmed

' EmailClient.Credentials = SMTPUserInfo

'// Send the Email!

EmailClient.Send(Message)

'// And confirm!

MsgBox("Done!")
"Rico" <me@you.comwrote in message news:s5MJh.41851$lY6.37874@edtnps90...
Hello,

I have an application in VB 2003 that uses System.Web that creates and
sends an email. I'm trying to turn this application into a Windows
Service in VB 2005 and have discovered that System.Web.Mail is replaced by
System.Net.Mail, but it seems the "To" property is read only now? How do
I set this property so I can actually send the email?

Any direction would be greatly appreciated.

Thanks!
Rick


Mar 14 '07 #2
Hi tc,

Sorry for the delay in responding, I've been away for a while.

Thanks. I will give that a try.

Rick

"tclancey" <tu**@idcodeware.co.ukwrote in message
news:uU****************@TK2MSFTNGP05.phx.gbl...
Try

'// Setup the new message.

Dim Message As New MailMessage("To", "From", "Subject", "Message")

'// Set the server to receive the smtp, exchange server or remote smtp
server

Dim EmailClient As New SmtpClient("DNS or IP")

'// If authentication is require it's set here.

' Dim SMTPUserInfo As New System.Net.NetworkCredential("Username",
"Password")

'// Defined by the above process, but doesn't seem to make much difference
is authentication is not required.

EmailClient.UseDefaultCredentials = False

'// If UserInfo is required this also need to be un-remmed

' EmailClient.Credentials = SMTPUserInfo

'// Send the Email!

EmailClient.Send(Message)

'// And confirm!

MsgBox("Done!")
"Rico" <me@you.comwrote in message
news:s5MJh.41851$lY6.37874@edtnps90...
>Hello,

I have an application in VB 2003 that uses System.Web that creates and
sends an email. I'm trying to turn this application into a Windows
Service in VB 2005 and have discovered that System.Web.Mail is replaced
by System.Net.Mail, but it seems the "To" property is read only now? How
do I set this property so I can actually send the email?

Any direction would be greatly appreciated.

Thanks!
Rick



Mar 17 '07 #3
Sweet! It works! Thanks TC!

"tclancey" <tu**@idcodeware.co.ukwrote in message
news:uU****************@TK2MSFTNGP05.phx.gbl...
Try

'// Setup the new message.

Dim Message As New MailMessage("To", "From", "Subject", "Message")

'// Set the server to receive the smtp, exchange server or remote smtp
server

Dim EmailClient As New SmtpClient("DNS or IP")

'// If authentication is require it's set here.

' Dim SMTPUserInfo As New System.Net.NetworkCredential("Username",
"Password")

'// Defined by the above process, but doesn't seem to make much difference
is authentication is not required.

EmailClient.UseDefaultCredentials = False

'// If UserInfo is required this also need to be un-remmed

' EmailClient.Credentials = SMTPUserInfo

'// Send the Email!

EmailClient.Send(Message)

'// And confirm!

MsgBox("Done!")
"Rico" <me@you.comwrote in message
news:s5MJh.41851$lY6.37874@edtnps90...
>Hello,

I have an application in VB 2003 that uses System.Web that creates and
sends an email. I'm trying to turn this application into a Windows
Service in VB 2005 and have discovered that System.Web.Mail is replaced
by System.Net.Mail, but it seems the "To" property is read only now? How
do I set this property so I can actually send the email?

Any direction would be greatly appreciated.

Thanks!
Rick



Mar 17 '07 #4

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

Similar topics

14
9010
by: Christophe Cerbourg | last post by:
hi, Bonjour, I'm using PHPMailer class to send mails and it works fine for HTML ones. But I can't manage to send correctly a text formatted mail... I tried this : - $message = "first...
0
522
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
4
2951
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
5
2608
by: BaWork | last post by:
I have a web form where a client can select which site members to send an email to. This form is populated from the contents of the member table, so the form can have 0-x names listed on it...
4
3557
by: David | last post by:
I'm wondering if python is capable of fairly precise timing and also sending data out the parallel port. For example ; making a 7.5 KHz square wave come out of one of the data pins on the...
13
3183
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using...
3
7692
by: Sydney | last post by:
Hi, I am trying to construct a WSE 2.0 security SOAP request in VBScript on an HTML page to send off to a webservice. I think I've almost got it but I'm having an issue generating the nonce...
2
10129
by: HK | last post by:
In VB.NET, I'm getting the exception "failure sending mail". I'm running VS 2005 on XP Home. This is a new install on a new PC. I've never had email problems with VS 2003, and there I could...
14
4634
by: John | last post by:
Hi How does one send email from within a vb.net app? Thanks Regards
9
3434
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
0
7224
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
7323
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
7379
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
7493
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
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
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...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
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...

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.