PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Sending Email in VB 2005
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Sending Email in VB 2005
![]() |
Sending Email in VB 2005 |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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.com> wrote 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 > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hi tc,
Sorry for the delay in responding, I've been away for a while. Thanks. I will give that a try. Rick "tclancey" <tull@idcodeware.co.uk> wrote in message news:uUYWW%23kZHHA.4940@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.com> wrote 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 >> >> > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Sweet! It works! Thanks TC!
"tclancey" <tull@idcodeware.co.uk> wrote in message news:uUYWW%23kZHHA.4940@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.com> wrote 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 >> >> > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

