|
-
October 17th, 1999, 07:59 AM
#1
Mail Sending
How to send E-Mails from a vb program ,do i do it using outlook , are there any other settings to be done to send mails from a vb program
-
October 17th, 1999, 08:12 AM
#2
Re: Mail Sending
VB 5 and 6 comes with a MAPI control. You can find tutorials on the net.
-
October 18th, 1999, 02:07 PM
#3
Re: Mail Sending
See http://www.freevbcode.com/ShowCode.Asp?ID=109. This is a .dll that handles e-mails in VB. It will help you avoid the various headaches associated with MAPI.
-
November 12th, 1999, 07:07 PM
#4
Re: Mail Sending
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
|