CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2006
    Posts
    10

    Lightbulb Problem with CDONTS email

    Hi Guru, I am trying to send email using CDONTS but the email is not sent and a message "Email is sent" is shown. Please, inform me what's wrong with the code below, thank's for your help;

    Sub SendEmail(ByVal From As String, ByVal sendto As String, ByVal subject As String, _
    ByVal EmailText As String, Optional ByVal Attachment As String)

    Dim rseomail As CDONTS.NewMail

    On Error GoTo NextTry

    Set rseomail = CreateObject("CDONTS.NewMail")
    rseomail.From = From ' "[email protected]"
    rseomail.To = sendto ' "[email protected]"
    rseomail.subject = subject ' "Re: Email testing"
    rseomail.Body = EmailText ' "This is to test email CDONTS"
    rseomail.attachfile (Attachment) ' "c:a.txt"
    rseomail.Importance = 0
    rseomail.Send
    MsgBox "Email is sent."
    Exit Sub

    NextTry:
    Call SendEmailOutlook(sendto, subject, EmailText, Attachment)


    End Sub

  2. #2
    Join Date
    Jun 2005
    Location
    Orissa
    Posts
    150

    Re: Problem with CDONTS email

    Quote Originally Posted by gracesup
    Hi Guru, I am trying to send email using CDONTS but the email is not sent and a message "Email is sent" is shown. Please, inform me what's wrong with the code below, thank's for your help;

    Sub SendEmail(ByVal From As String, ByVal sendto As String, ByVal subject As String, _
    ByVal EmailText As String, Optional ByVal Attachment As String)

    Dim rseomail As CDONTS.NewMail

    On Error GoTo NextTry

    Set rseomail = CreateObject("CDONTS.NewMail")
    rseomail.From = From ' "[email protected]"
    rseomail.To = sendto ' "[email protected]"
    rseomail.subject = subject ' "Re: Email testing"
    rseomail.Body = EmailText ' "This is to test email CDONTS"
    rseomail.attachfile (Attachment) ' "c:a.txt"
    rseomail.Importance = 0
    rseomail.Send
    MsgBox "Email is sent."
    Exit Sub

    NextTry:
    Call SendEmailOutlook(sendto, subject, EmailText, Attachment)


    End Sub
    hi,
    in attachfile you have missed the slash "\"

    and you are not closing the cdonts object.

    thanks

  3. #3
    Join Date
    Jun 2005
    Location
    Orissa
    Posts
    150

    Re: Problem with CDONTS email

    CDONTS line length is limited to 74 characters, if you are trying to send more than this, then it might create a problem.

    regards

  4. #4
    Join Date
    Mar 2006
    Posts
    10

    Re: Problem with CDONTS email

    Hi, thank's for trying but it still does not work after I add "\" , close the cdonts object, and the text is less than 74 char.
    Last edited by gracesup; March 15th, 2006 at 08:41 PM.

  5. #5
    Join Date
    Feb 2006
    Posts
    37

    Re: Problem with CDONTS email

    Quote Originally Posted by gracesup
    Hi, thank's for trying but it still does not work after I add "\" , close the cdonts object, and the text is less than 74 char.
    I think the main problem is with your SMTP service configuration,config the SMTP properly delivering email.
    You can check the mailroot for outgoing mails.If the mails are there just config SMTP properly.

    Rudraksh

  6. #6
    Join Date
    Mar 2006
    Posts
    10

    Re: Problem with CDONTS email

    Hi Rudraksh, I think you are right, I checked the mailroot and the outgoing mails are there. I config the SMTP for a single computer with IP 127.0.0.1 but it still doesn't work. Could it be my ISP that prevents emailing from vb or I didn't config correctly? Thank's for your info.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured