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-development-5/creating-an-html-email-body-96471.html?&highlight=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!!!