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

    generating emails

    hi i wanted to inquire abt as to hot to generate e mails using vb6.0


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: generating emails

    'make sure that on the default e-mail use of MAPI server is allowed

    Option Explicit
    '2 controls Microsoft MAPI Control 6.0 -> MAPISession and MAPIMessages

    Private Sub Command1_Click()
    Dim msg As String

    Screen.MousePointer = vbHourglass

    msg = "This is a test email"

    With Me

    .MAPILogOn.SignOn ' use current user

    Do While .MAPILogOn.SessionID = 0
    DoEvents ' need to wait until the new session is created
    Loop

    Call SendToEmail("[email protected]", msg)

    .MAPILogOn.SignOff
    End With

    Screen.MousePointer = vbNormal

    End Sub

    Private Sub SendToEmail(ByVal Email As String, ByVal msg As String)
    With MAPIMessages1
    'create a new message and address it
    .SessionID = MAPILogOn.SessionID
    .Compose
    .RecipDisplayName = Email
    .AddressResolveUI = True
    .RecipAddress = "smtp:" & Email

    .MsgSubject = "VB GENERATED E-MAIL"
    .MsgNoteText = msg
    .Send False
    End With
    End Sub



    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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