System.Web.Mail send mail fails

M

Morten Snedker

Using the procedure below on an ordinary form works fine. Moving it to
a service-project makes it fail on SmtpMail.Send(mail) with error:

"Could not access 'CDO Message' object."

Google-search shows other with similar problems when running in a
service, but I didn't reach a solution.

Any ideas as to what might be wrong?

Using the System.Web.Mail:

Sub SendMail(ByVal SendTo As String, ByVal Capacity As Int64)

WriteLog("sendmail triggered")
Try
Dim mail As New MailMessage
mail.To = Modtager
mail.From = "me"
mail.Subject = "Alert: lack of space"
mail.Body = "Space left: " & Capacity & "MB"
SmtpMail.SmtpServer = mySMTPserver
SmtpMail.Send(mail)
Catch ex As Exception
WriteLog("Email error: " & ex.Message)
End Try


End Sub

Regards /snedker
 
C

Carlos J. Quintero [.NET MVP]

It could be a credentials problem?

See if it is addressed here: http://systemwebmail.com/

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
S

stand__sure

that's my thought. I have seen this error in regular win apps as well
-- setting the principal policy in a windows app works if the user is
permitted to send mail; depending upon how the service runs, the
account soecified may not have sufficient privs
 
M

Morten Snedker

On Wed, 15 Jun 2005 17:39:42 +0200, "Carlos J. Quintero [.NET MVP]"

The file CDONTS.dll is not to be found on my system. However,
CDOsys.dll is. Is this a problem - and if so, how do I install
CDONTS.dll?

I'm using the SYSTEM-account to run the service. This account has
already been granted full control of the file (which is in the
System32 directory).

Regards /Snedker
 
C

Carlos J. Quintero [.NET MVP]

The file CDONTS.dll is not to be found on my system. However,
CDOsys.dll is. Is this a problem - and if so, how do I install
CDONTS.dll?

I think that that's explained at http://systemwebmail.com/ too.
--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 

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

Send Mails 1
Send Email Using VB 2008 Express 28
Can't SendMail 3
System.Web.Mail namespace? 13
Sending Automatic Email 2
How do I insert image in email body 2
Sendmail not sending 2
Send Email from C# App 4

Top