I have been having trouble getting images embedded
Code :
there is a class for this inPHP Code:try
{
Outlook._MailItem oMailItemCon = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
Outlook.
oMailItemCon.To = contactEMail.Text;
oMailItemCon.Subject = fldSubject.Text;
if(contact.State == "CO")
oMailItemCon.HTMLBody = fldMsg.Text += User.GetSignatureCO();
else
oMailItemCon.HTMLBody = fldMsg.Text += User.GetSignature();
foreach (string path in lstAttachments.Items)
{
oMailItemCon.Attachments.Add(path, Outlook.OlAttachmentType.olByValue,(int)oMailItemCon.Body.Length + 1, path);
}
string contentID = "test001@host";
//oMailItemCon.HtmlBody = "<html><body>this is a <img src=\"cid:" + contentID + "\"> embedded picture.</body></html>";
//oMailItemCon.AddEmbeddedImage;
//???
oMailItemCon
oMailItemCon.Send();
}
catch (Exception ex)
{
Alert.ErrMsgException(53224,"Could not send email message",ex);
}
System.Web.UI.WebControls
the code above is native C#. the contaxt of the application is that it is a contact management application that uses outlook to send messages. the reason I am using Outlook is because the environment has a robust firewall and the exchange server does not allow direct internal SMTP. (no relaying)
Below is a way to do it using CDO. I just need help making the connection. I think I need to add the images as an attachment and change the properties of the attachment. but I don't even have a clue how that would be accomplished.
Set oAttachs = oMsg.Attachments
Set oAttach = oAttachs.Item(1)
Set colFields = oAttach.Fields
Set oField = colFields.Add(CdoPR_ATTACH_MIME_TAG, "image/jpeg")
Set oField = colFields.Add(&H3712001E, "myident")
oMsg.Fields.Add "{0820060000000000C000000000000046}0x8514", 11, True
oMsg.Update


Reply With Quote