Results 1 to 3 of 3

Thread: VB Send Email Automatically

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Taipei
    Posts
    318

    Cool

    I use the following code to send email:

    mps.SignOn
    mpm.SessionID = mps.SessionID
    mpm.Compose
    mpm.RecipAddress = "[email protected]"
    mpm.ResolveName
    mpm.MsgSubject = "Subject"
    mpm.MsgNoteText = " "
    mpm.AttachmentIndex = 0
    mpm.Send True

    It works fine, except it will prompt out the outlook screen
    and need me to press "Send" button.

    1) Is there anyway to automatically send without press the button?

    2) I am not sure whether the above code can work with Netscape,
    I only tried with Outlook, does anybody can tell me whether it can work?

    Thanks


  2. #2
    Guest
    If you are only using outlook you can use this:-

    Dim objOutlook As New Outlook.Application
    Dim ObjOutlookMag As Outlook.MailItem
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
    With objOutlookMsg
    .To = Rst1!Email
    .Subject = "test"
    .Body = "Line1 "& vbNewLine & vbNewLine
    .Body = .Body & "Line2" & vbNewLine
    .Body = .Body & "Line3" & vbNewLine & vbNewLine
    .Send
    End With

    Set objOutlookMsg = Nothing

    'Close Outlook instance
    Set objOutlook = Nothing

    you will need to include "Microsoft Outlook *.0 object Lib" in your project referances.

  3. #3
    Guest
    Sorry that should have read:

    Dim objOutlook As New Outlook.Application
    Dim ObjOutlookMag As Outlook.MailItem
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
    With objOutlookMsg
    .To = "[email protected]"
    .Subject = "test"
    .Body = "Line1 "& vbNewLine & vbNewLine
    .Body = .Body & "Line2" & vbNewLine
    .Body = .Body & "Line3" & vbNewLine & vbNewLine
    .Send
    End With

    Set objOutlookMsg = Nothing

    'Close Outlook instance
    Set objOutlook = Nothing

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