HELP: Sending mail (Error)

Discussion in 'ASP .Net' started by VB Programmer, Jan 22, 2004.

  1. I am trying to send a simple email through my ASP.NET website. This is how
    I do it.
    Try
    System.Web.Mail.SmtpMail.Send("",
    "", "test", "TESTING 123")
    Catch ex As Exception
    Response.Write(ex.ToString)
    End Try
    Exit Sub

    I get this error:
    "System.Web.HttpException: Could not access 'CDO.Message' object. --->
    System.Reflection.TargetInvocationException: Exception has been thrown by
    the target of an invocation. --->
    System.Runtime.InteropServices.COMException (0x80040220): The "SendUsing"
    configuration value is invalid.

    --- End of inner exception stack trace ---
    at System.RuntimeType.InvokeDispMethod(String name, BindingFlags
    invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32
    culture, String[] namedParameters)
    at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
    Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
    CultureInfo culture, String[] namedParameters)
    at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder
    binder, Object target, Object[] args)
    at System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object
    obj, String methodName, Object[] args)
    at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
    methodName, Object[] args)
    --- End of inner exception stack trace ---
    at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
    methodName, Object[] args)
    at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
    at System.Web.Mail.CdoSysHelper.Send(String from, String to, String
    subject, String messageText)
    at System.Web.Mail.SmtpMail.Send(String from, String to, String subject,
    String messageText)
    at POWERWeb.TestCode.Page_Load(Object sender, EventArgs e) in
    C:\Inetpub\wwwroot\POWERWeb\TestCode.aspx.vb:line 36"

    Any ideas? Thanks.
    VB Programmer, Jan 22, 2004
    #1
    1. Advertising

  2. VB Programmer

    Cor Guest

    Re: Sending mail (Error)

    Hi VB programmer,

    This sample I made once for someone from Polen.
    wiadomosc=message

    I hope this helps?

    Cor

    \\\
    Dim wiadomosc As Web.Mail.MailMessage = New Web.Mail.MailMessage
    Dim config As MailAttachment = New
    MailAttachment("c:\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"
    System.Web.Mail.SmtpMail.Send(wiadomosc)
    ///




    > I do it.
    > Try
    > System.Web.Mail.SmtpMail.Send("",
    > "", "test", "TESTING 123")
    > Catch ex As Exception
    > Response.Write(ex.ToString)
    > End Try
    > Exit Sub
    >
    Cor, Jan 22, 2004
    #2
    1. Advertising

  3. Re: Sending mail (Error)

    I tried it and got the same error.

    I used "localhost" as the SmtpServer. Is this the right thing to do? Is
    the "Default SMTP Virtual Server" in ISM the only thing that needs to be
    running? Any ideas?

    Thanks.

    "Cor" <> wrote in message
    news:%...
    > Hi VB programmer,
    >
    > This sample I made once for someone from Polen.
    > wiadomosc=message
    >
    > I hope this helps?
    >
    > Cor
    >
    > \\\
    > Dim wiadomosc As Web.Mail.MailMessage = New Web.Mail.MailMessage
    > Dim config As MailAttachment = New
    > MailAttachment("c:\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"
    > System.Web.Mail.SmtpMail.Send(wiadomosc)
    > ///
    >
    >
    >
    >
    > > I do it.
    > > Try
    > > System.Web.Mail.SmtpMail.Send("",
    > > "", "test", "TESTING 123")
    > > Catch ex As Exception
    > > Response.Write(ex.ToString)
    > > End Try
    > > Exit Sub
    > >

    >
    >
    VB Programmer, Jan 22, 2004
    #3
  4. VB Programmer

    Cor Guest

    Re: Sending mail (Error)

    Hi,

    Do you have a IIS smtp mailserver running on that localhost.
    If you have you also can than try 127.0.0.1

    Cor
    > I used "localhost" as the SmtpServer. Is this the right thing to do? Is
    > the "Default SMTP Virtual Server" in ISM the only thing that needs to be
    > running? Any ideas?
    Cor, Jan 22, 2004
    #4
  5. Re: Sending mail (Error)

    "Cor" <> wrote in news::
    > Do you have a IIS smtp mailserver running on that localhost.
    > If you have you also can than try 127.0.0.1


    127.0.0.1 IS localhost.


    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"


    ELKNews - Get your free copy at http://www.atozedsoftware.com
    Chad Z. Hower aka Kudzu, Jan 22, 2004
    #5
  6. VB Programmer

    Cor Guest

    Re: Sending mail (Error)

    Hi Chad,

    >127.0.0.1 IS localhost.


    Thanks that you tell me that

    And you are sure that you can use LOCALHOST everywhere?

    Cor
    Cor, Jan 22, 2004
    #6
  7. Re: Sending mail (Error)

    "Cor" <> wrote in news::
    >>127.0.0.1 IS localhost.

    >
    > Thanks that you tell me that
    >
    > And you are sure that you can use LOCALHOST everywhere?


    Anywhere that you want to use 127.0.0.1 - except on Win95 B which has a bug
    with it, but you wont be running .net there anwyays.

    But you still have to have a SMTP server running.


    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"


    ELKNews - Get your free copy at http://www.atozedsoftware.com
    Chad Z. Hower aka Kudzu, Jan 22, 2004
    #7
  8. VB Programmer

    Charlie@CBFC Guest

    Re: Sending mail (Error)

    I get same problem. Never been able to figure it out. If all else fails,
    you can set SMTP property to your ISP's SMTP server. This is what I did.

    Charlie
    "Chad Z. Hower aka Kudzu" <> wrote in message
    news:Xns9478D14CED148cpub@127.0.0.1...
    > "Cor" <> wrote in news::
    > >>127.0.0.1 IS localhost.

    > >
    > > Thanks that you tell me that
    > >
    > > And you are sure that you can use LOCALHOST everywhere?

    >
    > Anywhere that you want to use 127.0.0.1 - except on Win95 B which has a

    bug
    > with it, but you wont be running .net there anwyays.
    >
    > But you still have to have a SMTP server running.
    >
    >
    > --
    > Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    > "Programming is an art form that fights back"
    >
    >
    > ELKNews - Get your free copy at http://www.atozedsoftware.com
    >
    Charlie@CBFC, Jan 22, 2004
    #8
  9. Re: Sending mail (Error)

    These codes are working without error message.. But I didn't get email.. Is that really working or not?
    =?Utf-8?B?dmFnem9uZQ==?=, Feb 4, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    55,463
  2. Replies:
    0
    Views:
    1,354
  3. Luke
    Replies:
    2
    Views:
    4,701
    Nigel Wade
    Mar 15, 2007
  4. Replies:
    2
    Views:
    4,432
  5. Don Quijote de Nicaragua

    Error + Send Mail + ERROR: Failure sending mail.

    Don Quijote de Nicaragua, Jun 26, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    1,515
    Don Quijote de Nicaragua
    Jun 26, 2008
Loading...

Share This Page