Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > CDO.Message background image

Reply
Thread Tools

CDO.Message background image

 
 
Guest
Posts: n/a
 
      07-25-2005
Hi - is it possible to set an image as the background body image
(non-repeating too) in a message sent using CDO. I don't want to embed an
external webpage (I have to insert user form related variables back in the
body of the email) and the image is on the server the mail is being
generated from - have googled for ages on this one but can't seem to find
anything suitable...

Thanks for any help on this.


 
Reply With Quote
 
 
 
 
Aaron Bertrand [SQL Server MVP]
Guest
Posts: n/a
 
      07-25-2005
> Hi - is it possible to set an image as the background body image

Yes, use MHTMLBody.
http://www.aspfaq.com/2474
See "Embedding images in the e-mail"

> (non-repeating too)


This is an HTML/CSS issue. You would use the same style settings as you
would in any other HTML page. Please follow up for this part of it in an
HTML/CSS newsgroup.


 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      07-25-2005
>> Hi - is it possible to set an image as the background body image
>
> Yes, use MHTMLBody.
> http://www.aspfaq.com/2474
> See "Embedding images in the e-mail"


Well, thanks - but do I really have to embed a webpage and create further
asp code just to grab the variables I wanted to put in the email in that
seperate asp page?

Sounds like a lot more work for something that should be a couple more lines
of code! I've already html'd my code as much as I wanted to - I just wanted
now to put a background image in. I'm already using .HTMLBody - just thought
there might be a one liner to insert the background image in.

If you're saying there isn't - that's a real shame.


 
Reply With Quote
 
Aaron Bertrand [SQL Server MVP]
Guest
Posts: n/a
 
      07-25-2005
> Well, thanks - but do I really have to embed a webpage and create further
> asp code just to grab the variables I wanted to put in the email in that
> seperate asp page?


Sorry, somehow I thought you wanted to attach it without having to reference
it.

If all of the rest of your images are being referenced from online (e.g.
<img src=http://whatever>) can't you do the same for the background?

<body background=http://whatever>

And again, as for the non-repeating part, you can apply this with CSS
(off-topic here).


 
Reply With Quote
 
Guest
Posts: n/a
 
      07-25-2005
> Sorry, somehow I thought you wanted to attach it without having to
> reference it.


That's OK - maybe I should have been clearer.

> If all of the rest of your images are being referenced from online (e.g.
> <img src=http://whatever>) can't you do the same for the background?
>
> <body background=http://whatever>


No! It just doesn't work! All the other elements in the HTML work - except
for this - I have tried the http path, the C:\ path, the relative path and
none of them work! That's why I came here to post!


 
Reply With Quote
 
Aaron Bertrand [SQL Server MVP]
Guest
Posts: n/a
 
      07-25-2005
>> <body background=http://whatever>
>
> No! It just doesn't work!


What about setting the background of a table, or a table cell, or using CSS
e.g. BODY { background-image:url(http://www.whatever.com/whatever.gif); })?
Please follow up in a CSS or HTML newsgroup for different ways to apply a
background image.

> All the other elements in the HTML work - except for this - I have tried
> the http path, the C:\ path, the relative path and none of them work!


C:\ and relative will never work if you send the e-mail anywhere... I think
it may be a mail client issue, how many different clients have you tested?
Just yours?


 
Reply With Quote
 
Guest
Posts: n/a
 
      07-25-2005
> What about setting the background of a table, or a table cell, or using
> CSS e.g. BODY {
> background-image:url(http://www.whatever.com/whatever.gif); })?


Same again! I've even tried posting the variables to a new asp page like you
suggested with CreateMHTMLBody = myURL but that doesn't work either - I get
a 500 internal server error : ( this is really getting on my nerves now. It
should be so easy.

> C:\ and relative will never work if you send the e-mail anywhere... I
> think it may be a mail client issue, how many different clients have you
> tested? Just yours?


Yes, but as its plain old OE I'm sure 60-70% of users have it or derivatives
that work in the same way as it. Its just got to work!

Perhaps you could explain what's wrong with this code that's causing the 500
internal server error -

<%
If Request.Form("process") = "True" Then
formToName = Request.Form("to_name")
formFromName = Request.Form("from_name")
formEmailTo = Request.Form("to_email")

makeURL = "http://www.ourserver.com/thepage.asp?to_name=" & formToName &
"from_name=" & formFromName & ""


Set MyCDONTSMail = CreateObject("CDO.Message")
MyCDONTSMail.From = "(E-Mail Removed)"
MyCDONTSMail.To = formEmailTo
MyCDONTSMail.Subject = "ourtext"
MyCDONTSMail.CreateMHTMLBody makeURL
MyCDONTSMail.Send
Set MyCDONTSMail=nothing

End If
%>

and then in the thepage.asp:

<%
formToName = Request.querystring("to_name")
formFromName = Request.querystring("from_name")
%>

and in the body of thepage.asp

<%
formToName=Request.querystring("to_name")
Response.Write(formToName)
%>

I know its not perfect code yet as I'm still testing but this throws up
errors! Why?!

Arrghhh. Its one of those days where a little thing spiralls into a
troublesome thing.



 
Reply With Quote
 
Aaron Bertrand [SQL Server MVP]
Guest
Posts: n/a
 
      07-25-2005
> I get a 500 internal server error : (

(a) on which page?

(b) TURN OFF FRIENDLY ERRORS.
http://www.aspfaq.com/2109


 
Reply With Quote
 
Guest
Posts: n/a
 
      07-25-2005
>> I get a 500 internal server error : (
>
> (a) on which page?


Well I wasn't sure which page it meant the error was coming from because the
application essentially inserted another asp page's generated html page into
an email - now I've switched off the friendly errors I've tracked down the
error to access is denied on the line that says:

MyCDONTSMail.CreateMHTMLBody makeURL

So I simplified the line to just go to another asp which does work, with the
same result!

Odd! ...and infuriating!


 
Reply With Quote
 
Guest
Posts: n/a
 
      07-25-2005
>>> I get a 500 internal server error : (
>>
>> (a) on which page?


Sorry - I realised my last message might not have made sense. Basically the
problem is that this standard code
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="(E-Mail Removed)"
myMail.To="(E-Mail Removed)"
myMail.CreateMHTMLBody "http://www.w3schools.com/asp/"
myMail.Send
set myMail=nothing
%>throws up the error Access is denied on the linemyMail.CreateMHTMLBody
"http://www.w3schools.com/asp/"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DIV background-repeat background-image? For shadow effect jc ASP .Net 3 03-19-2008 04:19 PM
DIV background-repeat background-image for shadowing effect jc HTML 1 03-19-2008 02:16 PM
CSS background-image ... Possible to scale image? Noozer HTML 5 12-07-2004 09:27 PM
[GUI Image] attach an image as a background picture Raydog Java 3 04-09-2004 06:12 PM
changing a background image to a background colour? Dj Frenzy Javascript 3 02-10-2004 08:08 PM



Advertisments