Getting current sender email address in exchange using vb.net

  • Thread starter Thread starter R V Prasad
  • Start date Start date
R

R V Prasad

Guest
Hi,

I have created a basic form in vb.net with one button. When we click on button an email will trigger to particular email ID mentioned in the code. And I want to include the current sender in email Cc while sending an email. I want to get the current sender email address. I'm using below code but it isn't working. Can anyone advise here.


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim oApp As New Outlook.Application()
Dim oMsg As Outlook.MailItem = DirectCast(oApp.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)

Dim SenderEMailID = oMsg.SenderEmailAddress

MessageBox.Show(SenderEMailID)

oMsg.To = "abc@xyz.com"
oMsg.CC = SenderEMailID
oMsg.Subject = "Test Mail"
oMsg.Send()

End Sub

Continue reading...
 

Similar threads

Back
Top