Results 1 to 22 of 22

Thread: CDO (do not receive email)

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    CDO (do not receive email)

    Hi guys,
    I am looking to use CDO to send a message through my SMTP server. I get the messagebox saying the email has been sent but I never get the email. This is the code I am using:
    VB Code:
    1. Option Explicit
    2.  
    3. Const SMTP_SERVER   As String = "mail.mydomain.com"
    4. Const SMTP_PORT     As Long = 25
    5. Const MAIL_SUBJECT  As String = "Message from Business Manager User."
    6. Const MAIL_TO       As String = "[email protected]"
    7.  
    8. Private objMessage  As CDO.Message
    9.  
    10. Private Sub Form_Load()
    11.     ConfigureForm Me
    12. End Sub
    13.  
    14. Private Sub cmdClose_Click()
    15.     If MsgBox("You are about to close this screen." & vbNewLine & _
    16.               "Are you sure you want to do that?", vbQuestion + vbYesNo, "Confirmation.") = vbYes Then
    17.              
    18.         Unload Me
    19.     Else 'vbno
    20.         'do nothing
    21.     End If
    22. End Sub
    23.  
    24. Private Sub cmdReset_Click()
    25.     If MsgBox("You are about to reset this screen." & vbNewLine & _
    26.               "Are you sure you want to do that?", vbQuestion + vbYesNo, "Confirmation.") = vbYes Then
    27.              
    28.         txtEmailAddress.Text = vbNullString
    29.         txtMessage.Text = vbNullString
    30.         txtEmailAddress.SetFocus
    31.     Else 'vbNo
    32.         'do nothing
    33.     End If
    34. End Sub
    35.  
    36. Private Sub cmdSend_Click()
    37.     On Error GoTo Err
    38.    
    39.     Set objMessage = New CDO.Message
    40.    
    41.     With objMessage
    42.         .Subject = MAIL_SUBJECT
    43.         .From = txtEmailAddress.Text
    44.         .To = MAIL_TO
    45.         .TextBody = txtMessage.Text
    46.         .Configuration.Fields.Item _
    47.         ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    48.         .Configuration.Fields.Item _
    49.         ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_SERVER
    50.         .Configuration.Fields.Item _
    51.         ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTP_PORT
    52.         .Configuration.Fields.Update
    53.         .Send
    54.     End With
    55.    
    56.     Set objMessage = Nothing
    57.    
    58.     If MsgBox("Your message to the authors was" & vbNewLine & _
    59.               "successfully sent.", vbInformation, "Email Message Sent.") = vbOK Then
    60.                  
    61.             Unload Me
    62.     End If
    63.        
    64.     Exit Sub
    65. Err:
    66.         If MsgBox("Your message to the authors could" & vbNewLine & _
    67.                   "not be sent.  Please try again later.", vbCritical, "Email Message Not Sent.") = vbOK Then
    68.                  
    69.             Unload Me
    70.         End If
    71. End Sub

  2. #2
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: CDO (do not receive email)

    Everything works okay as far as the mail code ...
    will need to check your SMTP server ...

    I know you're changing the SMTP server and TO values right?

    Also, what OS is this on?
    Could be a CDO issue ... dont know ..

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: CDO (do not receive email)

    Quote Originally Posted by rory
    Everything works okay as far as the mail code ...
    will need to check your SMTP server ...

    I know you're changing the SMTP server and TO values right?

    Also, what OS is this on?
    Could be a CDO issue ... dont know ..
    yes, i put those in the to and smpt so that people dont try to login to my mail server. what about username/password for login... wouldnt i need that? if so, how would it be set? when it comes to the OS. i am on XP. i havent been able to get this CDO code to work even though it says the email has been sent. i might have to go and use MAPI instead.

  4. #4
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: CDO (do not receive email)

    also, just found out you can use the CDO constants ..

    VB Code:
    1. Set objMessage = New CDO.Message
    2.     With objMessage
    3.         .Subject = MAIL_SUBJECT
    4.         .From = MAIL_FROM
    5.         .To = MAIL_TO
    6.         .TextBody = MAIL_MESSAGE
    7.         .Configuration.Fields.Item(cdoSendUsingMethod) = 2
    8.         .Configuration.Fields.Item(cdoSMTPServer) = SMTP_SERVER
    9.         .Configuration.Fields.Item(cdoSMTPServerPort) = SMTP_PORT
    10.         .Configuration.Fields.Item(cdoSMTPAuthenticate) = 1
    11.         .Configuration.Fields.Item(cdoSendUserName) = "username"
    12.         .Configuration.Fields.Item(cdoSendPassword) = "password"
    13.         .Configuration.Fields.Update
    14.         .Send
    15.     End With
    16.     Set objMessage = Nothing

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: CDO (do not receive email)

    i have no idea. now i am getting a message failed message box when the username and the password are correct. i am going to give up with CDO. no point in wasting my time with this part of my app. It might be easier with MAPI.

  6. #6
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: [RESOLVED] CDO (do not receive email)

    Maybe a CDO issue ...
    Can you send mail using that server and another program such as Outlook Express? I have an SMTP Server test program you can PM me for if you like .. ill put it on my site to download.

    Rory

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [RESOLVED] CDO (do not receive email)

    Quote Originally Posted by rory
    Maybe a CDO issue ...
    Can you send mail using that server and another program such as Outlook Express? I have an SMTP Server test program you can PM me for if you like .. ill put it on my site to download.

    Rory
    yes, i use outlook to connect to send email but i am required to authenticate using a username/password. i would have thought specifying this in CDO would have worked but have no clue. oh well.

  8. #8
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: [RESOLVED] CDO (do not receive email)

    Quote Originally Posted by BrailleSchool
    yes, i use outlook to connect to send email but i am required to authenticate using a username/password. i would have thought specifying this in CDO would have worked but have no clue. oh well.
    Download the SMTP Server Test program here (smtpTest_setup.zip) .. install and run .. enter all the info (user and pass also) and let me know if it sends mail .. this uses Winsock in VB .. i know this program works for auth as i used it in another program for a yahoo account in the US,

    http://bahamassecurity.com/uploads/

    I cant test Auth right now as my ISP blocks port 25 and doesnt require auth..

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: CDO (do not receive email)

    Quote Originally Posted by rory
    Download the SMTP Server Test program here (smtpTest_setup.zip) .. install and run .. enter all the info (user and pass also) and let me know if it sends mail .. this uses Winsock in VB .. i know this program works for auth as i used it in another program for a yahoo account in the US,

    http://bahamassecurity.com/uploads/

    I cant test Auth right now as my ISP blocks port 25 and doesnt require auth..
    ill try it and get back to you.

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [RESOLVED] CDO (do not receive email)

    ok, i ran your app and the screen shots show what happens. seems like the hosting provider doesnt allow transport. ugh.
    Attached Images Attached Images   

  11. #11
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: [RESOLVED] CDO (do not receive email)

    Strange .. you said it works in Outlook?
    Is this a SMTP or HTTP server?

  12. #12

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [RESOLVED] CDO (do not receive email)

    Quote Originally Posted by rory
    Strange .. you said it works in Outlook?
    Is this a SMTP or HTTP server?
    SMTP/POP3 for email and i can use any kind of IMAP email client with no problem.

  13. #13
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: CDO (do not receive email)

    Can you telnet to the smtp server and port, then type HELP and see if it uses the AUTH command?

    Do you require any other settings like SSL?

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: CDO (do not receive email)

    Quote Originally Posted by rory
    Can you telnet to the smtp server and port, then type HELP and see if it uses the AUTH command?
    i used hyperterminal and its not letting me do any commands, tried to use telnet in cpanel and its not doing squat right now
    Do you require any other settings like SSL?
    no

  15. #15
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: CDO (do not receive email)

    telnet mail.domain.ext 25

    wait for response ...

    HELP

  16. #16

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: CDO (do not receive email)

    Quote Originally Posted by rory
    telnet mail.domain.ext 25

    wait for response ...

    HELP
    i did it from the command prompt instead and the capture shows what happened.
    Attached Images Attached Images  

  17. #17
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: CDO (do not receive email)

    I dont have anyway too test auth right now ...but found this info ..

    "This error occurs when authorisation is sent that isn't wanted/recognised by the receiving email server.

    A solution to this problem is to leave out either the user name, password or both in the SMTP set-up "

  18. #18

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: CDO (do not receive email)

    Quote Originally Posted by rory
    I dont have anyway too test auth right now ...but found this info ..

    "This error occurs when authorisation is sent that isn't wanted/recognised by the receiving email server.

    A solution to this problem is to leave out either the user name, password or both in the SMTP set-up "
    you can only send and receive through the mail server when youre authenticated in outlook so it would have to apply in any other situation.

  19. #19
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: CDO (do not receive email)

    If i had access to a PC there with UltraVNC and the SMTP server i could figure it out for yah .. let me know ..

  20. #20

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: CDO (do not receive email)

    Quote Originally Posted by rory
    If i had access to a PC there with UltraVNC and the SMTP server i could figure it out for yah .. let me know ..
    i am not totally sure what you mean so can you elaborate for me?

  21. #21
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: CDO (do not receive email)

    Quote Originally Posted by BrailleSchool
    i am not totally sure what you mean so can you elaborate for me?
    was saying if i had access to a PC through UltraVNC then I could test the commands ... but if you want the source for the SMTP program PM me .. then you can play with the commands from your end..

  22. #22

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: CDO (do not receive email)

    Quote Originally Posted by rory
    was saying if i had access to a PC through UltraVNC then I could test the commands ... but if you want the source for the SMTP program PM me .. then you can play with the commands from your end..
    i can give you access if you like... how would this be done?

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