Pengetahuan dasar mengirim Email dengan VisualBasic VB.Net via Outlook

 

1.download: class library  Microsoft.Office.Interop.Outlook

2. copy file Microsoft.Office.Interop.Outlook.dll ke bin/debug   di folder project

4.add reference Microsoft.Office.Interop.Outlook pada project VB anda

3. buat program spt dibawah ini

==================================================================

Imports outlook = Microsoft.Office.Interop.Outlook

Module ModuleKirimEmail

Public Sub kirimEmail(ByVal alamatEmail As String, ByVal subjekemail As String, ByVal bodyemail As String)

Dim pesanemail As outlook.MailItem
Dim AplikasiOutlook As New outlook.Application
Try
pesanemail= AplikasiOutlook.CreateItem(outlook.OlItemType.olMailItem)
Dim penerima As outlook.Recipients = pesanemail.Recipients
penerima.Add(alamatEmail)
pesanemail.Subject = subjekemail
pesanemail.Body = bodyemail
pesanemail.BodyFormat = outlook.OlBodyFormat.olFormatHTML
pesanemail.Send()
Catch ex As Exception
MessageBox.Show(“Email tdk terkirim”)
Finally
pesanemail = Nothing
AplikasiOutlook = Nothing
End Try
End Sub

=======================================================================

pada form lain method di modul bisa dipanggil dgn

CALL kirimEmail(“alamatemail@gmail.com”, “subjekemail”, “apa kabar…”)

Advertisements

About pccontrol

Berisi Tutorial Menggunakan PC untuk mengontrol Peralatan dengan cara mudah & praktis.

Posted on 10/04/2016, in Daftar isi, Visual Basic . Net. Bookmark the permalink. Leave a comment.

Komentar ,Saran atau Pertanyaan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: