By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,064 Members | 1,524 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,064 IT Pros & Developers. It's quick & easy.

System.Web.Mail send mail fails

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

"Morten Snedker" <morten_spammenot_ATdbconsult.dk> escribió en el mensaje
news:dj********************************@4ax.com...
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

Nov 21 '05 #2

P: n/a
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

Nov 21 '05 #3

P: n/a
On Wed, 15 Jun 2005 17:39:42 +0200, "Carlos J. Quintero [.NET MVP]"
<ca*****@NOSPAMsogecable.com> wrote:

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
It could be a credentials problem?
See if it is addressed here: http://systemwebmail.com/


Nov 21 '05 #4

P: n/a
> 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
Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.