Sending mail from vb using outlook express-VBForums
Results 1 to 9 of 9

Thread: Sending mail from vb using outlook express

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    India
    Posts
    11

    Sending mail from vb using outlook express

    Hai everybody,
    i have a piece of coding that is used to send a mail from the vb6 using outlook expresss. The code is shown below.

    Private outlk As Outlook.Application

    Private Sub cmdSendmail_Click()
    Set outlk = New Outlook.Application
    Dim addr As New Collection 'address
    Dim attach As New Collection 'attachment
    Dim subject As String 'subjeect
    Dim body As String 'body
    Dim blnSendOK As Boolean

    subject = "Testing of Subject"
    body = "Testing of Body"
    addr.Add "k_priyan@yahoo.com"
    attach.Add "c:\myfile.emf"
    blnSendOK = OutLookMailto(outlk, subject, body, addr, attach)
    If blnSendOK Then
    MsgBox ("Send OK!!")
    Else
    MsgBox "not sent"
    End If
    End Sub

    Public Function OutLookMailto(OutLooks As Outlook.Application, _
    ByVal strSubject As String, _
    ByVal strText As String, colAddrList As Collection, _
    colAttachments As Collection) As Boolean
    Dim Mail As MailItem
    Dim strTemp
    Set Mail = OutLooks.CreateItem(olMailItem) 'Mail Item
    With Mail
    For Each strTemp In colAddrList
    .Recipients.Add strTemp
    Next
    For Each strTemp In colAttachments
    .Attachments.Add strTemp
    Next
    .subject = strSubject
    .body = strText
    .Save
    .Send
    End With
    Set Mail = Nothing
    OutLookMailto = True
    Exit Function
    Errh:
    OutLookMailto = False
    End Function

    i am getting the output send ok!! message box. but i have not received any mail yet.

    Can anyone sort out this problem, it will be more helpful to me.

    Thanks.

    yours,
    Gopal

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I much prefer the CDONTS.NewMail object. Try looking it up!
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    India
    Posts
    11

    what references should i add to my project

    To work with CDONTS to send mail from vb what references should i add to my project. should i install anything for that. please specify the required details.

    Thanks.

    yours,
    Gopal

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    India
    Posts
    11

    I must use outlook express

    hai Sastraxi and everybody,
    I am in the need to use the outlook express compulsarily.
    As i mentioned in the first post with the coding, the mail has been sent but i am not able to receive it. And also, when running , an application named "Outlook Express" appears and immediately disappears.
    But i should have the Outlook express explicitly open.
    So please provide me the way to do this. it is very urgent.
    Thanks.

    Yours,
    Gopal

  5. #5
    Addicted Member
    Join Date
    Jul 2002
    Location
    10000 light years away
    Posts
    143
    Buddy, i guess the code u have posted is for MS Outlook, not Outlook Express!
    I was gratified to be able to answer promptly. I said I don't know!

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    India
    Posts
    11

    both are same

    Hai ms-outlook and outlook express are same .

  7. #7
    Addicted Member
    Join Date
    Jul 2002
    Location
    10000 light years away
    Posts
    143
    They are not the same. The given code is automation of MS Outlook. I had worked on a similar project. the same code without any modification doesn't work for Outlook Express.
    I was gratified to be able to answer promptly. I said I don't know!

  8. #8

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    India
    Posts
    11

    Yes it is correct

    hai Binish,
    U r right. i found the difference between the two. Thanks.
    But, i am not in the position to open only the window of the outlook express to send mail.But the code that i have given above send the mail automatically.
    So provide me the way in which i could see the page used to send mail of the Outlook express.
    I hope u might understand the problem.
    Expecting solution evry soon.

    Thanks,
    Gopal

  9. #9

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    India
    Posts
    11

    Finally i Found out

    Hai everybody,
    Thanks to everyone. I got the solution.

    yours,
    Gopal

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.