send mail with VB

G

Guest

Hi,

I got this code from the web, but i can't get it to work. Is there any special setting on my local WinXP machine to make it works? I have enabled the IIS-SMTP Service. Anything else?

Dim mailMsg As New CDO.Message
Dim mailConfig
Set mailConfig = CreateObject("CDO.Configuration")

mailConfig.Fields(edoSMTPServer) = "localhost"
mailConfig.Fields(edoSendUsingMethod) = cdoSendUsingPort
mailConfig.Fields.Update

mailMsg.configuration = mailConfig
mailMsg.To = "(e-mail address removed)"
mailMsg.From ="(e-mail address removed)"
mailMsg.Subject = "testing mail"
mailMsg.AddAttachment("c:\Temp\test.txt")
mailMsg.Send
 
T

Tom Shelton

Hi,

I got this code from the web, but i can't get it to work. Is there any special setting on my local WinXP machine to make it works? I have enabled the IIS-SMTP Service. Anything else?

Dim mailMsg As New CDO.Message
Dim mailConfig
Set mailConfig = CreateObject("CDO.Configuration")

mailConfig.Fields(edoSMTPServer) = "localhost"
mailConfig.Fields(edoSendUsingMethod) = cdoSendUsingPort
mailConfig.Fields.Update

mailMsg.configuration = mailConfig
mailMsg.To = "(e-mail address removed)"
mailMsg.From ="(e-mail address removed)"
mailMsg.Subject = "testing mail"
mailMsg.AddAttachment("c:\Temp\test.txt")
mailMsg.Send

With the above code... What doesn't work? Do you get an exception? Does
it just not send? Need more info...

Also, have you looked at System.Web.Mail? To use it you'll need to add a
reference to System.Web.dll to your project.
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?Um95IFQ=?= said:
I got this code from the web, but i can't get it to work. Is there
any special setting on my local WinXP machine to make it works? I have
enabled the IIS-SMTP Service. Anything else?

Is there a reason why you are not using the classes provided in the
'System.Web.Mail' namespace? For questions on this namespace, take a
look at <URL:http://www.systemwebmail.net/>.
 

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