vb.net Outlook - no error in the code but mail is not sent

  • Thread starter Thread starter hkjobs1988
  • Start date Start date
H

hkjobs1988

Guest
I m trying to send mail using the outlook , program is not showing any error but mail is not sent.

I have connected my gmail account to outlook , when manually tested it is outlook is working fine.

While configuring gmail id to outlook test mail came successfully.

Os Windows 10 , and outlook 2010 Below is the code and setting snapshot.

Please check and let me know what needs to be done ..

Imports Outlook = Microsoft.Office.Interop.Outlook ' At the General Section of the Form
Module Outlook_mail1
Private Sub cmdMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim oOutlook As New Outlook.Application
Dim olNs As Outlook.NameSpace
Dim oMail As Outlook.MailItem
oOutlook = CreateObject("Outlook.Application")
olNs = oOutlook.GetNamespace("MAPI")
olNs.Logon()
oMail = oOutlook.CreateItem(Outlook.OlItemType.olMailItem)
oMail.Subject = "Subject of the mail"
oMail.Body = "Text of the mail"
oMail.To = "hitesh.kumar@bhartiaxa.com"
oMail.ReadReceiptRequested = True
oMail.Send()
End Sub

End Module

Continue reading...
 

Similar threads

Back
Top