sending e-mail via smtp server

W

Wojciech Kowaluk

i want send e-mail usimg smtp server. i wrote this code:
Dim wiadomosc As Web.Mail.MailMessage = New Web.Mail.MailMessage
Dim config As Web.Mail.MailAttachment = New _
Web.Mail.MailAttachment(sciezka)
wiadomosc.Attachments.Add(config)
wiadomosc.From = "(e-mail address removed)"
wiadomosc.To = "(e-mail address removed)"
wiadomosc.Subject = "..."
wiadomosc.Body = "..."
wiadomosc.BodyFormat = Web.Mail.MailFormat.Text
System.Web.Mail.SmtpMail.SmtpServer = "smtp.o2.pl"
Try
System.Web.Mail.SmtpMail.Send(wiadomosc)
Catch ex As Exception
MsgBox(ex.Message)
End Try

and i get error:
System.Web.HttpException in system.web.dll (Couldnt acces CDO.Message).

what is the problem with this? what i'm doing wrong? pls help.

Regards,
Wojtek
 
C

Cor

Dzien Dobry Wojciech,

I think this kind of errors is not the code but just because there is no
SMTP server reachable or something, I know it is few, but that was my first
thougth.

Tylko w mysli "a little bit"

Cor
 
W

Wojciech Kowaluk

Dzien Dobry Cor (you know polish? thats nice :) ),

SMTP adress is correct and server is working.
I have tried with diffrent servers but this don't change anything.

I'm running Windows XP SP1 and using VS 2003 Edition.

Regards,
Wojtek
 
C

Cor

Hi Wojciech,

I did test this and this did work
\\\\
Dim wiadomosc As Web.Mail.MailMessage = New Web.Mail.MailMessage
Dim config As MailAttachment = New
MailAttachment("c:\test1\test.txt")
wiadomosc.Attachments.Add(config)
wiadomosc.From = xxx@xxx
wiadomosc.To = xxx@xxx
wiadomosc.Subject = "..."
wiadomosc.Body = "..."
wiadomosc.BodyFormat = Web.Mail.MailFormat.Text
System.Web.Mail.SmtpMail.SmtpServer = "xxxx.xxxx.xx"
///
I hope it helps you a little bit.

Cor
 
W

Wojciech Kowaluk

I solved it! Sender E-mail adress wasnt correct (i thought that this is not
important), but it must be. Thanks for your sugestion.

Pozdrawiam,
Wojciech
 

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

Similar Threads


Top