| w3JMail Examples |
Examples 3.7
|
This example was sent to us by xxx and it shows how to use Dimac w3 JMail in Visual Basic. This example was created by Steve Weller, Thanks alot Steve! |
To use w3 JMail in VB, you need to go to the Project/References window and Browse to the jMail.dll file wherever you have installed it (default c:\windows\system32\jmail\jmail.dll) and add the jMail Library as a reference in your project. |
|
Private Sub SendMail()
On Error Resume Next ' Create instance of SMTPMail object Set Jmail = CreateObject("JMail.SMTPMail") ' My SMTP Server Address (uses default Port=25) Jmail.ServerAddress = "<<address of your SMTP server>>" ' My Name and Mail Address Jmail.Sender = "<<your name>>" Jmail.ReplyTo = "<<your email address>>" ' Recipient Address and Name Jmail.AddRecipient "<<recipient email address>>", "<>" ' Compose message Jmail.Subject = "Testing the excellent jmail" Jmail.Priority = 1 Jmail.Body = "Body and soul." & vbCrLf & "Way cool..." Jmail.AddAttachment "c:\windows\desktop\test.doc" ' Send the mail Jmail.Execute ' Test for errors If Err <> 0 Then MsgBox Error$, vbCritical, "Mail Error" End If ' Dispose object Set Jmail = Nothing End Sub |
|
|