By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,919 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,919 IT Pros & Developers. It's quick & easy.

Set ContentBase in HTML Email using CDO

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.