James Sadlier
October 7th, 1999, 12:25 PM
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!
Any help would be greatly appreciated!
|
Click to See Complete Forum and Search --> : Sending a Mail James Sadlier October 7th, 1999, 12:25 PM 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! Lothar Haensler October 8th, 1999, 08:51 AM 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. czimmerman October 8th, 1999, 10:57 AM 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 How to include the Mapi control in VB6...it's saying error in loading dll when i try to include the Mapiformobject type library... Garry October 29th, 1999, 09:15 AM 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, 06:04 PM 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 codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |