System.Web.Mail send mail fails

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Morten Snedker

    #1

    System.Web.Mail send mail fails

    Using the procedure below on an ordinary form works fine. Moving it to
    a service-project makes it fail on SmtpMail.Send(m ail) 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("sendm ail 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.SmtpSe rver = mySMTPserver
    SmtpMail.Send(m ail)
    Catch ex As Exception
    WriteLog("Email error: " & ex.Message)
    End Try


    End Sub

    Regards /snedker
  • Carlos J. Quintero [.NET MVP]

    #2
    Re: System.Web.Mail send mail fails

    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:
    MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.


    "Morten Snedker" <morten_spammen ot_ATdbconsult. dk> escribió en el mensaje
    news:djc0b1d2sg mb2otctjl9aecpq naeshmji3@4ax.c om...[color=blue]
    > Using the procedure below on an ordinary form works fine. Moving it to
    > a service-project makes it fail on SmtpMail.Send(m ail) 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("sendm ail 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.SmtpSe rver = mySMTPserver
    > SmtpMail.Send(m ail)
    > Catch ex As Exception
    > WriteLog("Email error: " & ex.Message)
    > End Try
    >
    >
    > End Sub
    >
    > Regards /snedker[/color]


    Comment

    • stand__sure

      #3
      Re: System.Web.Mail send mail fails

      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

      Comment

      • Morten Snedker

        #4
        Re: System.Web.Mail send mail fails

        On Wed, 15 Jun 2005 17:39:42 +0200, "Carlos J. Quintero [.NET MVP]"
        <carlosq@NOSPAM sogecable.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
        [color=blue]
        >It could be a credentials problem?
        >See if it is addressed here: http://systemwebmail.com/[/color]

        Comment

        • Carlos J. Quintero [.NET MVP]

          #5
          Re: System.Web.Mail send mail fails

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

          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:
          MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.



          Comment

          Working...