471,354 Members | 1,213 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Set ContentBase in HTML Email using CDO

Hello All:

I am trying to understand how to set the ContentBase of an HTML email
I'm sending using CDO. The HTML source can be any .aspx page on on the
website. Basically, I'm creating an "Email This Page" link.

I am able to get the email sent just fine. However, all the images are
referenced using relative urls (which is what I prefer to use in all my
Webforms) and therefore, the image and style sheet references are
broken.

Isn't there a way to use the ContentBase property such that the
relative urls are referenced from a full url as specified through the
ContentBase?

My code is as follows:

*************************************

void Send_Email( object s, EventArgs e )
{
CDO.Message msg = new CDO.MessageClass();
msg.CreateMHTMLBody("http://localhost/mypage.aspx?print=Y",
CDO.CdoMHTMLFlags.cdoSuppressAll,"", "");
msg.To = emailTo.Text;
msg.CC = emailCC.Text;
msg.From = "in**@reactornet.com";
msg.Subject = "Thank You!";
msg.TextBody = "http://localhost/mypage.aspx?print=Y";

msg.Configuration.Fields[CDO.CdoMailHeader.cdoContentBase].Value =
"http://localhost";

msg.Configuration.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value
= 2;

msg.Configuration.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"].Value
= 25;

msg.Configuration.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value
= "mail.cinemasolutions.com";
msg.Configuration.Fields.Update();
msg.Send();

Response.Redirect("~/forms/email_response.aspx");
}
Thank you in advance for your help.

Feb 7 '06 #1
0 1211

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by James Hong | last post: by
reply views Thread by Carlos Ribeiro | last post: by
4 posts views Thread by clintonG | last post: by
9 posts views Thread by Nathan Sokalski | last post: by
3 posts views Thread by Erik Johnson | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.