•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 370,613 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,116 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 2080 | Replies: 2
![]() |
•
•
Join Date: Oct 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Dear All,
This is my first post - I was delighted to stumble across such a great resource.
I am trying to set up a simple e-card system for my website using HTML formatted CDOSYS email messages. At present I have the system up and running in a raw form by sending a pre-designed webpage (containing the image/card and a link back to my site) using MHTML. Here is my current code for the CODSYS page:
This works fine but, because it is MHTML, the size of the email is quite large as the image etc. is actually sent to the recipient's inbox rather than linking back to the file on my server.
I have searched this and other forums and a few threads point to another method which seems to link the HTML rather than send it as MHTML (eg. http://forums.aspfree.com/asp-develo...ght=HTML+email) .
Unfortunately my NEWBIE understanding of ASP prevents me from applying this method to my own scenario. As far as I can make out I have to set the "HTMLBody Option" (how?) and then use some form of variable (eg strHTML = strHTML & "<HTML>"???). As I said however, I don't know exactly how to do this and each version I see appears to be different.
Ideally the recipient of the e-card would see the image in the email with a short HTML-formatted message from the sender. This now works for my MHTML method but each email is over 40kb in size which is unfair to the recipient who may not desire the ecard. I would like if the email size was under 10kb by linkind to the HTML.
Using MHTML means I have to have a pre-designed page for every card - it looks like this other way is more flexible and I could load in a "response.write(request.form("image_name.jpg"))" clause in the relevant section since the rest of the page layout will be identical. This would make maintenance much easier. Maybe not possible?
Any pearls of wisdom would be hugely appreciated. I am only beginning in this ASP undiscovered country but am very excited by it already!!!
Many thanks
-eogmp3
This is my first post - I was delighted to stumble across such a great resource.
I am trying to set up a simple e-card system for my website using HTML formatted CDOSYS email messages. At present I have the system up and running in a raw form by sending a pre-designed webpage (containing the image/card and a link back to my site) using MHTML. Here is my current code for the CODSYS page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<%
SMTPServer = "server.mysite.com"
cdoURL = "http://schemas.microsoft.com/cdo/configuration/"
MHTMLBody = "http://www.mysite.com/ecard/image1.asp"
Set cdoM = CreateObject("CDO.Message")
Set cdoC = CreateObject("CDO.Configuration")
Set cdoF = cdoC.Fields
With cdoF
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Update
End With
With cdoM
Set .Configuration = cdoC
.CreateMHTMLBody MHTMLBody
.From = Request("sender")
.To = Request("receiver")
.Subject = Request("subject")
.TextBody = Request("body")
.Send
End With
Set cdoM = Nothing
Set cdoS = Nothing
Set cdoF = Nothing
%>
Your ecard has been sent. Thank you!
</body>
</html>This works fine but, because it is MHTML, the size of the email is quite large as the image etc. is actually sent to the recipient's inbox rather than linking back to the file on my server.
I have searched this and other forums and a few threads point to another method which seems to link the HTML rather than send it as MHTML (eg. http://forums.aspfree.com/asp-develo...ght=HTML+email) .
Unfortunately my NEWBIE understanding of ASP prevents me from applying this method to my own scenario. As far as I can make out I have to set the "HTMLBody Option" (how?) and then use some form of variable (eg strHTML = strHTML & "<HTML>"???). As I said however, I don't know exactly how to do this and each version I see appears to be different.
Ideally the recipient of the e-card would see the image in the email with a short HTML-formatted message from the sender. This now works for my MHTML method but each email is over 40kb in size which is unfair to the recipient who may not desire the ecard. I would like if the email size was under 10kb by linkind to the HTML.
Using MHTML means I have to have a pre-designed page for every card - it looks like this other way is more flexible and I could load in a "response.write(request.form("image_name.jpg"))" clause in the relevant section since the rest of the page layout will be identical. This would make maintenance much easier. Maybe not possible?
Any pearls of wisdom would be hugely appreciated. I am only beginning in this ASP undiscovered country but am very excited by it already!!!
Many thanks
-eogmp3
•
•
Join Date: Oct 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Hi again. I've been messing around here and think i'm getting somewhere. Unfortunately I can't access the actual server that I'll be using at present (I will tomorrow at work) and I can't seem to get my localhost to process CDOSYS (browser gives the following error :Error Type:CDO.Message.1 (0x80070005). Access is denied. /ecard/html4.asp, line 25). This means that I can't really test out what i'm doing.
Can someone tell me if I'm on the right track with this code:
Much appreciated.
-eogmp3
Can someone tell me if I'm on the right track with this code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<%
dim MyMail, strHtmlBody
SMTPServer = "localhost"
cdoURL = "http://schemas.microsoft.com/cdo/configuration/"
Set MyMail = CreateObject("CDO.Message")
Set cdoC = CreateObject("CDO.Configuration")
Set cdoF = cdoC.Fields
With cdoF
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Update
End With
strHtmlBody = strHtmlBody & "<HTML>"
strHtmlBody = strHtmlBody & "<p align="center"> Hello <% response.write(request.form("rName"))%>, <% response.write(request.form("sName"))%> has sent you this ecard:"
strHtmlBody = strHtmlBody & "<img src=""http://www.mysite.com/images/ecard1.jpg""></p>"
strHtmlBody = strHtmlBody & "<b>Message:</b><% response.write(request.form("body"))%>"
strHtmlBody = strHtmlBody & "<p><a href=""http://www.mysite.com/ecard.asp"">click here</a> to send your own ecard."
strHtmlBody = strHtmlBody & "<p>Thank you</p>"
With MyMail
Set .Configuration = cdoC
.From = Request("sAddress")
.To = Request("rAddress")
.Subject = "Test"
.HTMLBody = strHtmlBody
.Send
End With
Set MyMail = Nothing
Set cdoS = Nothing
Set cdoF = Nothing
%>
Your ecard has been sent. Thank you!
</body>
</html>Much appreciated.
-eogmp3
Last edited by eogmp3 : Oct 22nd, 2006 at 1:45 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP Marketplace
- PHP - subscribers' email (PHP)
- Linking to asp.net page from html page (ASP.NET)
- What exactly is xml? (RSS, Web Services and SOAP)
- Pop-up window overlapping issues (HTML and CSS)
- CSS pseudo-letter ??? (HTML and CSS)
- ABI Network trouble (Viruses, Spyware and other Nasties)
- Warning you're in Danger - Spyware Problem (Viruses, Spyware and other Nasties)
Other Threads in the ASP Forum
- Previous Thread: Asp applications
- Next Thread: Update Column Serial Wise


Linear Mode