1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Private Sub Mail_Click(sender As Object, e As EventArgs) Handles Mail.Click
Try
Dim Outlook As Outlook.Application
Dim Mail As Outlook.MailItem
Dim Acc As Outlook.Account
Outlook = New Outlook.Application()
Mail = CType(Outlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem), Outlook.MailItem)
Mail.To = "essai.essai.com"
Mail.CC = "essai2.essai2.com"
Mail.Subject = "Demande de Devis"
For Each Acc In Outlook.Session.Accounts
If Acc.AccountType = Microsoft.Office.Interop.Outlook.OlAccountType.olPop3 Then
Mail.Sender = CType(Acc, Outlook.AddressEntry)
End If
Next
Mail.Attachments.Add("C:\Users\All Users\Image.bmp")
' Mail.HTMLBody = "Bonjour," & "<br/>" & "<br/>" & "Voici le devis " & TextBox31.Text & "<br/>" & "<br/>" & "Cordialement," & "<br/>" & "<br/>"
' Mail.Body = "Bonjour,....."
Mail.Display()
My.Computer.FileSystem.DeleteFile("C:\Users\All Users\Image.bmp",
Microsoft.VisualBasic.FileIO.UIOption.AllDialogs,
Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin)
Catch ex As Exception
MessageBox.Show("Opération annulée par l'utilisateur !", "Envoyer un e-mail", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub |