Hello Ami
I saw, that you support Declan by an issue with Outlook and Sent E-Mails on Behalf. I have the problem, that I cant sent E-Mails on behalf with this code from a shared mailbox. Maybe you can give me an hint, what I am doing wrongly? Secondly, I am also not got the output that thee E-Mail was sent.
Dim oApp As Microsoft.Office.Interop.Outlook._Application
oApp = New Microsoft.Office.Interop.Outlook.Application
Dim myItem As Microsoft.Office.Interop.Outlook.MailItem
try
myItem = oApp.CreateItemFromTemplate(templatePath)
myItem.From = FromAddress
myItem.To = mailAddress
myItem.Subject = myItem.Subject _
.Replace("<Name>", firstName) _
.Replace("<Surname>", lastName)
myItem.HTMLBody = myItem.HTMLBody _
.Replace( _
"<span style='background:silver;mso-highlight:silver'>Ms. X</span> / <span style='background:silver;mso-highlight:silver'>Mr. Y</span>", firstLine) _
.Replace( _
"<span style='background:silver;mso-highlight:silver'>Sehr geehrte Frau X</span> / <span style='background:silver;mso-highlight:silver'>Sehr geehrter Herr Y</span>", firstLine) _
.Replace( _
"<span lang=FR style='mso-bidi-font-family:""xxxx Type Light"";background:lightgrey;mso-highlight:lightgrey;mso-ansi-language:FR'>Madame </span><span lang=FR style='mso-bidi-font-family:""XXXX Type Light"";mso-ansi-language:FR'>, / <span style='background:lightgrey;mso-highlight:lightgrey'>Monsieur</span>,</span>", firstLine) _
.Replace( _
"<span lang=IT style='mso-bidi-font-family:""xxxx Type Light"";background:lightgrey;mso-highlight:lightgrey;mso-ansi-language:IT'>Gentile signora X</span><span lang=IT style='mso-bidi-font-family:""xxxx Type Light"";mso-ansi-language:IT'> / <span style='background:lightgrey;mso-highlight:lightgrey'>Egregio signor Y</span></span>", firstLine)
If(itMailInside.Length > 1)
myItem.HTMLBody = myItem.HTMLBody _
.Replace( _
"<span style='background:lightgrey;mso-highlight:lightgrey'>tenuta</span> / <span style='background:lightgrey;mso-highlight:lightgrey'>tenuto</span>", itMailInside)
End If
myItem.Send()
mailSent = True
mailSent = False
If myItem Is Nothing
Else
myItem.Close(Microsoft.Office.Interop.Outlook.OlInspectorClose.olDiscard)
End If
Catch ex as Exception
End try
------------------------------
Andre Koepplin
Business Process Analyst
Wroclaw
------------------------------