Sending mail via CDO.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nitindel
    New Member
    • Dec 2007
    • 67

    Sending mail via CDO.

    Hi All,
    I am using CDO to send mail in ASP ,VBScipt.....

    [Code]
    Set myMail=CreateOb ject("CDO.Messa ge")
    myMail.Subject= "Your User ID and Password for PMIS"
    myMail.From="ab c@somdomain.com "
    myMail.To=Reque st.Form("to")
    myMail.TextBody =Request.Form(" body")

    myMail.Send

    set myMail=nothing

    But the mail is not going on post.
    Please let me know what can be the reasons for mail not going .

    Regards
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi Nitindel,

    The first thing to check is that your mailto property is being properly set. Are you certain that Request.Form("t o") has a value?

    If it has then your mail could be being blocked for a number of reasons but I'll need more information from you in order to work out what the problem is.

    Are you receving an error message when you try to send or is it failing silently? If there is no error message then your code is probably fine but the smtp service you are using may be the problem.

    You don't say if you are using your local host ("127.0.0.1" ) as the smtp server - is this the case or are you using a remote mail server? Can you show the code where you are specifying the mail server and port you are using.

    Please provide a few more details as requested above and I'll try to diagnose the problem for you.

    Cheers,

    Dr B

    Comment

    • CroCrew
      Recognized Expert Contributor
      • Jan 2008
      • 564

      #3
      Hello nitindel,

      Try wrapping some error trapping around your object. This should give you/us some meaningful errors if the problem is truly coming from your mail object.

      Hope this helps~

      Like this:
      [code=asp]
      Set myMail=CreateOb ject("CDO.Messa ge")
      myMail.Subject= "Your User ID and Password for PMIS"
      myMail.From="ab c@somdomain.com "
      myMail.To=Reque st.Form("to")
      myMail.TextBody =Request.Form(" body")

      On Error Resume Next
      myMail.Send
      If Err <> 0 Then
      Response.Write( "Mail Object Error : " & Err.Description )
      End If

      set myMail=nothing

      [/code]

      Comment

      • nitindel
        New Member
        • Dec 2007
        • 67

        #4
        Thansk for the reply....
        I ahve tried.... all this stuff......
        but not able to trouble shoot...this... .

        I have gone nuts with this problem

        Thnaks

        Comment

        • DrBunchman
          Recognized Expert Contributor
          • Jan 2008
          • 979

          #5
          So is it a code problem or an smtp problem?

          Have you checked your firewall settings?

          smtp can be blocked by certain anti-virus software as well - have you looked into that?

          Dr B

          Comment

          Working...