Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1751
Number of posts: 4473

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Cdonts and desgin of the email Posted by rasha on 30 Nov 2003 at 1:32 AM
I can send emails by cdonts but I do not how to include images in those emails. My web site has a stylesheet page that controls all pages of the site, I want to be able to relate the email to this stylesheet that is located on the server and I want to be able to add an image at the top of the email page. Can any body help me with this.

Thanks in advance

Report
Re: Cdonts and desgin of the email Posted by lillu on 1 Dec 2003 at 10:38 AM
http://authors.aspalliance.com/chrisg/default.asp?article=104

: I can send emails by cdonts but I do not how to include images in those emails. My web site has a stylesheet page that controls all pages of the site, I want to be able to relate the email to this stylesheet that is located on the server and I want to be able to add an image at the top of the email page. Can any body help me with this.
:
: Thanks in advance
:
:


To err is human, but to really foul things up requires a computer. (Farmers Almanac)

Report
Re: Cdonts and desgin of the email Posted by rasha on 2 Dec 2003 at 4:37 AM
Thanks much for your help but when I visited your link and tried to use the demo it did not work and it did not. I tried to make it from my server but still it did not work . I change the line 50 to look to my image but it did not work too
objMail.AttachURL server.MapPath("images\banner\basket.jpg"), "logo.gif"

any help?
Also I wonder if you can tell me how to embed the style sheet fie that controls the colors of the site to control the colors of the email message too.

Thank you

Report
Re: Cdonts and desgin of the email Posted by Manning on 2 Dec 2003 at 12:43 PM
: Thanks much for your help but when I visited your link and tried to use the demo it did not work and it did not. I tried to make it from my server but still it did not work . I change the line 50 to look to my image but it did not work too
: objMail.AttachURL server.MapPath("images\banner\basket.jpg"), "logo.gif"
:
: any help?

The second parameter has to be the name you are attaching the file as, which means it must correspond to the <img src=""> tag in your email. If you did not reference it as <img src="logo.gif"> in your message, then that is why it did not work.
Report
Re: Cdonts and desgin of the email Posted by rasha on 4 Dec 2003 at 3:54 AM
Hello Manning,
I have tried yor answer but nothing worked. Here is my code, I will be vwry thankfull to you if find the error to me

<HTML>

<body bgcolor=white>

<%

if request.ServerVariables("REQUEST_METHOD") = "GET" then

%>

<form action="htmlemail.asp" method=post>
<font face=verdana>
Your Name <input type="text" name="strName"> Your EMail <input type="text" name="strEmail">
<br>
Recipient Email <input type="text" name="strTo">
<p>

<textarea cols=40 rows=4 name=message>Your message</textarea>

</p>

<input type=submit name=send value=Send>

</form>

<%

else

Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.Importance = 1
objMail.From = request("strName") & "<" & request("strEmail") & ">"
objMail.To = request("strTo")
objMail.Subject = "Example of HTML EMail with Embeded Image"

' this is my messages HTML
strMsg = "" & _
"<html><body bgcolor=red>" & _
"<a href=""http://www.RealWorldASP.com/""><img src=""images\banner\basket.jpg"" border=0 alt=""RealWorldASP"">" & _
"</a><p><font face=verdana>Example of a HTML Email with embedded Image<P><br>" & _
request("message") & _
"</body></html>"

' set the format of the email to html, etc
objMail.BodyFormat = 0
objMail.MailFormat = 0
objMail.Body = strMsg

' attach our image file and set the url to simply logo.gif
objMail.AttachURL server.MapPath("images\banner\basket.jpg"), "logo.gif"
objMail.Send

' destroy the email object
Set objMail = Nothing

%>
<h1>
<font face=verdana>Message Sent, Thanks!</font>
</h1>

<% end if %>

</body></html>

Thanks a lot
Rasha, Egypt

Report
Re: Cdonts and desgin of the email Posted by Manning on 4 Dec 2003 at 6:41 AM
: Hello Manning,
: I have tried yor answer but nothing worked. Here is my code, I will be vwry thankfull to you if find the error to me
:
: <HTML>
:
: <body bgcolor=white>
:
: <%
:
: if request.ServerVariables("REQUEST_METHOD") = "GET" then
:
: %>
:
: <form action="htmlemail.asp" method=post>
: <font face=verdana>
: Your Name <input type="text" name="strName"> Your EMail <input type="text" name="strEmail">
:
: Recipient Email <input type="text" name="strTo">
: <p>
:
: <textarea cols=40 rows=4 name=message>Your message</textarea>
:
: </p>
:
: <input type=submit name=send value=Send>
:
: </form>
:
: <%
:
: else
:
: Set objMail = Server.CreateObject("CDONTS.NewMail")
: objMail.Importance = 1
: objMail.From = request("strName") & "<" & request("strEmail") & ">"
: objMail.To = request("strTo")
: objMail.Subject = "Example of HTML EMail with Embeded Image"
:
: ' this is my messages HTML
: strMsg = "" & _
: "<html><body bgcolor=red>" & _
: "<a href=""http://www.RealWorldASP.com/""><img src=""images\banner\basket.jpg"" border=0 alt=""RealWorldASP"">" & _
: "</a><p><font face=verdana>Example of a HTML Email with embedded Image<P>" & _
: request("message") & _
: "</body></html>"
:
: ' set the format of the email to html, etc
: objMail.BodyFormat = 0
: objMail.MailFormat = 0
: objMail.Body = strMsg
:
: ' attach our image file and set the url to simply logo.gif
: objMail.AttachURL server.MapPath("images\banner\basket.jpg"), "logo.gif"
: objMail.Send
:
: ' destroy the email object
: Set objMail = Nothing
:
: %>
: <h1>
: <font face=verdana>Message Sent, Thanks!</font>
: </h1>
:
: <% end if %>
:
: </body></html>


I've never embedded images, but I'll bet the problem is that you have to synchronize the two things I marked in red above. Don't provide a path to the image, and make sure you use the same filename on both lines.
Report
Re: Cdonts and desgin of the email Posted by vanith on 4 Dec 2003 at 1:25 PM
I hope Manning's reply would have solved your problem.
I was just curious to know if you tried the fully resolved URL in the IMG tag as


 strMsg = "" & _ 
: "<html><body bgcolor=red>" & _ 
: "<a href=""http://www.RealWorldASP.com/""><img src=""http://www.RealWorldASP.com/images/banner/basket.jpg"" border=0 alt=""RealWorldASP"">" & _ 
: "</a><p><font face=verdana>Example of a HTML Email with embedded Image<P>" & _ 
: request("message") & _ 
: "</body></html>" 


In this case, you do not need to AttachURL any images. When the user opens his email [Online], the image is loaded into his mail automatically from the website.

:)heers,
Vanith

Report
Re: Cdonts and desgin of the email Posted by Manning on 4 Dec 2003 at 1:44 PM
: I hope Manning's reply would have solved your problem.
: I was just curious to know if you tried the fully resolved URL in the IMG tag as
:
:
:
:  strMsg = "" & _ 
: : "<html><body bgcolor=red>" & _ 
: : "<a href=""http://www.RealWorldASP.com/""><img src=""http://www.RealWorldASP.com/images/banner/basket.jpg"" border=0 alt=""RealWorldASP"">" & _ 
: : "</a><p><font face=verdana>Example of a HTML Email with embedded Image<P>" & _ 
: : request("message") & _ 
: : "</body></html>" 
: 

:
: In this case, you do not need to AttachURL any images. When the user opens his email [Online], the image is loaded into his mail automatically from the website.


This is heresay, but I've heard most e-mail clients don't allow external images to be loaded. For example, I could embed the following string into an email:

<img src="http://www.myserver.com/spamlist.cgi?id=100">

The ID number would be unique to each recipient of the message, and could correspond to their email address in a database. That spamlist.cgi could update a record in that database, effectively saying "the e-mail address that corresponds to ID 100 is active, because the recipient of this e-mail just tried to retrieve an image hosted on my server".

Now the spammers can keep pretty accurate records of how many targets their spam is actually reaching.
Report
Re: Cdonts and desgin of the email Posted by rasha on 6 Dec 2003 at 11:25 PM
This message was edited by rasha at 2003-12-6 23:26:0

Hi,

Thanks for both of you Manning and vanith for your help, I have tried both of your solutions but nothing work.

As for the Manning solution, you have colored in red to parts of code, the first part gives the path of the image but the second part does not do the same job so we do not need to synchronize them (instead it gives the alt or the alternative text that appears on the image and this is any text you just type.

As for the vanith solution, I tried the fully resolved URL in the IMG tag but it did not work and i do not know why.

If any there are more ideas I will appreciate it.

Thanks


Report
Re: Cdonts and desgin of the email Posted by Manning on 7 Dec 2003 at 6:57 AM
: As for the Manning solution, you have colored in red to parts of code, the first part gives the path of the image but the second part does not do the same job so we do not need to synchronize them (instead it gives the alt or the alternative text that appears on the image and this is any text you just type.


Did you even try to make the suggested change, or are you just assuming it is wrong? All this time I have been making the assumption that what I was saying is correct, so after you said that I thought I should look it up to know for sure. And as I suspected, this source backs up my theory:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_denali_attachurl_method_cdonts_newmail_object_.asp



: As for the vanith solution, I tried the fully resolved URL in the IMG tag but it did not work and i do not know why.


Probably for the reason I said in my reply (privacy issues)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.