My VB.NET Application needs to send email periodically to internet users .. how to do this? ..
Thanks a lot in advance
Regards
Winanjaya
Printable View
My VB.NET Application needs to send email periodically to internet users .. how to do this? ..
Thanks a lot in advance
Regards
Winanjaya
Here is a sample I cut and pasted from one of my forms. Keep in mind that even though this is a windows form you still use the systems.web.mail to fire off the email.
VB Code:
Dim newMail As New System.Web.mail.MailMessage newMail.To = "[email protected]" newMail.From = "[email protected]" newMail.Body = _ "This is a test email message from the new time " & _ "entry application. This function will be used in " & _ "the new T.E. App to announce when a payroll period " & _ "begins and ends." & vbCr & vbCr & "This announcement " & _ "is an automated message so please do not reply to it. " & _ "You can just ignore this message for now." & vbCr & vbCr & _ "Thank You," & vbCr & vbCr & "Signature Here" newMail.Subject = "Start Payroll <---- Just ignore for now" System.Web.Mail.SmtpMail.SmtpServer = "MailServerName" System.Web.Mail.SmtpMail.Send(newMail)
Just change the To, the From and the mail server name to match your needs.
Thanks but When I try to send though the local SMTP service on Win 2000 AS I get "Error!! Could not access 'CD).Message' object"
am I missing something?
TIA
Winanjaya
Lets see the code you are using. There are limitations to using this method. First, IIS has to be installed. That is probably where you are getting an error.
The way I got around that when I was creating a project recently was to put the email functionality in a web service. The client app calls the web service passing in all the information, and the web service does the emailing. Something to look into if you are operating in a networked environment.
hellswraith,
I'm trying to do the same thing & receive the error message:
Could not access 'CDO.Message' object. I've added a reference to system.web & system.web.services to my project. I have IIS installed. The code I am runnign is exactally what Bukhix had posted before (with my server name changed along with the To & From addresses. I am on a networked environment and need to send these emails to outside customers. Thanks for any help you can offer.
Corinne
Since you are on a local network and trying to send emails to outside domains you may be experiencing a problem with authentication.
You may want to check this thread for a possible solution:
Please help SMTP server authentication
Let me know if that takes care of the problem.
Hi Bukhix,
I am referencing System.Web.Mail in my C#.net application
but there is a problem. It says
D:\Projects\Mailing\frmSendMail.cs(9): The type or namespace name 'Mail' does not exist in the class or amespace 'System.Web' (are you missing an assembly reference?)
Do I need to include anyother namespace?
What file (*.dll) should I reference in my project so that
the namespace is recognised?
thanks