VB.Net and Email

G

Guest

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.

On two new machines, we have XP Service Pack 2. They came with outlook 2003,
so no upgrade was needed. On these machines, we get an error stating that
"modAgentSys can not create activex component" which then crashes the program.

Any ideas?
 
G

Guest

How are you sending the email? Its very easy to send email from .Net using
the System.Messaging namespace.

Here's a sample

Dim oMessage As New System.Web.Mail.MailMessage()

oMessage.To = "(e-mail address removed)"
oMessage.From = "(e-mail address removed)"
oMessage.Subject = "A New Email Message"
oMessage.Body = "I hope you get this email! I’ll talk to you later!"

' This part is required if your mail server requires authenticatio
oMessage.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

oMessage.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.sendmail.com
oMessage.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "(e-mail address removed)
oMessage.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MyPa$$word"

oMessage.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

System.Web.Mail.SmtpMail.SmtpServer = "mail.sendmail.com"

Try
System.Web.Mail.SmtpMail.Send(oMessage)

Response.Write("Email sent!")
Catch Ex As Exception
Response.Write("Unable to send mail! " & Ex.Message)
End Try

I hope this helps.
 
B

Brett O'Callaghan

John said:
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.

I've used Indy (http://www.IndyProject.org/) for emailing to get
around this issue of not knowing what components and versions are
installed on what machines. Put the Indy files in the app directory
and it seems to work everywhere regardless of what they install or
change elsewhere on the machine.
 
G

Guest

To make things more confusing...we have a new development machine, that is XP
service pack 2.

the email works fine on this one...but not on the others
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top