Windows service and outlook

P

Pablo A Castillo

hey I use this code, I want to send a email all tha days (hour: 8:00 AM), but
my code has somes problems.


Code:
Protected Overrides Sub OnStart(ByVal args() As String)
WriteToLog()
End Sub

Protected Overrides Sub OnStop()

End Sub

Private Sub WriteToLog()

Dim oApp As Microsoft.Office.Interop.Outlook.Application = New
Microsoft.Office.Interop.Outlook.Application()
Dim eMail As Microsoft.Office.Interop.Outlook.MailItem =
oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
Dim subjectEmail As String = "Test de envio de emails desde ASP.NET"
Dim bodyEmail As String = "test de envio de emails desde ASP.NET"
Dim sentContacts As Microsoft.Office.Interop.Outlook.MAPIFolder =
oApp.ActiveExplorer.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderContacts)
With eMail
.Subject = "hey" 'TextBox2.Text
.To = "(e-mail address removed)" 'TextBox1.Text
.Body = "TextBox8.Text"
.Importance =
Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh
.Send()
End With

End Sub



this dont send the email!


thanks,

Pablo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top