Send Mail from Web Service

M

mmassari

Hi,
I need to send a mail message from a web service.
If i execute the code from a Windows Form Application the message is
sended correctly but if i execute the same code from a web service an
exception is throwed "Could not access 'CDO.Message' object".

That's the code:

Public Sub Send()
Try
Dim i As String
Dim m As New MailMessage
m.BodyEncoding = System.Text.Encoding.UTF8
m.BodyFormat = MailFormat.Html
m.Priority = MailPriority.Normal

m.Subject = "Hello"
m.To = "(e-mail address removed)"
m.From = "(e-mail address removed)"
m.Body = "Hello world"
Dim ss As SmtpMail
ss.SmtpServer = "mail.company.com"
ss.Send(m)
Catch ex As Exception
Debug.Write("Error: " & ex.Message)
End Try
End Sub

Why?
I need special permission?
I miss something?

Thanks

Michele
 

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

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top