CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2008
    Posts
    70

    Email sending from VB 6.0 application

    Hi,
    From my VB 6.0 program, I want to send email to any email with attachment addresses.
    I have access to a mail server - with sufficient privileges to relay messages from.

    I tried, Dim objSendMail As CDONTS.NewMail - object for this.

    1. mail could be sent only to an address in the above mail server only, not to yahoo/gmail
    addreses.

    2. I attahced a .pdf file, but that was received in non-readable format, what went wrong.

    3. Which email class is best suited for sending mail from vb 6.0, running in Windows 2003 server



    below give the code for sending mail
    Sub SendEmail()
    Const constRoutine As String = "SendEmail"

    Dim strSendTo As String
    Dim objSendMail As CDONTS.NewMail
    Dim i As Integer

    On Error GoTo TryMAPI

    'Do not cause the user a major error, just log the error and keep going
    'If SendTo = "" Then Exit Sub

    Set objSendMail = New CDONTS.NewMail

    With objSendMail
    On Error Resume Next
    .From = "[email protected]"

    .To = "[email protected]" 'SendTo

    .Subject = "see the vb 18.36"
    .Body = "see the vb mail 18.36"

    .AttachFile ("Cfrty_dfgt.pdf")
    .Send
    End With

    MsgBox "Ok.."

    End Sub
    VB.Net 2005, Net Framework 2.0

  2. #2
    Join Date
    Dec 2008
    Posts
    19

    Re: Email sending from VB 6.0 application

    It's no long CDONTS. It's CDO. See here:
    http://msdn.microsoft.com/en-us/library/ms988614.aspx

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