|
-
October 7th, 1999, 12:25 PM
#1
Sending a Mail
Hi - does anyone know how I'd send a mail using VB6? Is there a control, or do I've to go into MAPI?
Any help would be greatly appreciated!
-
October 8th, 1999, 08:51 AM
#2
Re: Sending a Mail
you can add the "microsoft MAPI controls" to your project via Project/components.
Use the MAPI Session control to establish a MAPI session, use the MAPI messages control to read or send messages.
-
October 8th, 1999, 10:57 AM
#3
Re: Sending a Mail
See http://www.freevbcode.com/ShowCode.Asp?ID=109 for a .dll that allows you to do this. It will save you the headaches of MAPI.
-
October 29th, 1999, 02:23 AM
#4
Re: Sending a Mail
How to include the Mapi control in VB6...it's saying
error in loading dll when i try to include the Mapiformobject type library...
-
October 29th, 1999, 09:15 AM
#5
Re: Sending a Mail
Go to options, go to references in the avaliable references you will find Common Dialog you wil find the control added on your controls panel go ahead and select it.
Garry
-
November 12th, 1999, 07:04 PM
#6
Re: Sending a Mail
If you have Outlook installed, an easy way is to create a class module called cOutlook like below. Then, you can somewhere else declare it
Public Mailer as New cOutlook
and then use the Mailer.SendMail (.....) method to send email.
If you have to use MAPI, then use the .dll the other guy recommends.
Option Explicit
Private Outlook As New Outlook.Application
Private mblnTerminateOutlook As Boolean
Private Sub Class_Initialize()
mblnTerminateOutlook = Outlook.ActiveExplorer Is Nothing
End Sub
Private Sub Class_Terminate()
If mblnTerminateOutlook Then Outlook.Quit
Set Outlook = Nothing
End Sub
Public Sub SendMail(strTo As String, strSubject As String, _
strMessageText As String, Optional strCC As String, _
Optional vntAttachmentPath As Variant)
Dim i As Integer
With Outlook
With .CreateItem(olMailItem)
.To = strTo
.CC = strCC
.Subject = strSubject
.Body = strMessageText & vbCrLf & vbCrLf
If IsArray(vntAttachmentPath) Then
For i = 0 To UBound(vntAttachmentPath)
.Attachments.Add vntAttachmentPath(i), , Len(.Body)
Next i
End If
.Send
End With
End With
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|