Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Emailing HTML Newsletter in ASP


  • Please log in to reply

#1
Immortalarena

Immortalarena

    Member

  • Member
  • PipPipPip
  • 216 posts
I set up a site that can send out emails of a newsletter, I wanted these letters to be in an HTML format. So here is the code I found to do that:

<!-- 
	METADATA 
	TYPE="typelib" 
	UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"  
	NAME="CDO for Windows 2000 Library" 
--> 
<%Response.Buffer=TRUE%>
<%
'Dimension variables


dim msgstring


	Set cdoConfig = CreateObject("CDO.Configuration")  
 	Dim News_ID
 	News_ID = Request.Form("newsID")
	With cdoConfig.Fields  
		.Item(cdoSendUsingMethod) = cdoSendUsingPort  
		.Item(cdoSMTPServer) = "mail.smtpserver.com"
		.Item(cdoSMTPAuthenticate) = 1  
		.Item(cdoSendUsername) = "[email protected]"  
		.Item(cdoSendPassword) = "Password"  
		.Update  
	End With 
 
 	MHTMLBody = "http://troop101.net/base/newsletter/newsletter.asp?newsID=" & News_ID
 	msgstring = "HTML View has been disabled on your machine, please go to: " & _
 	"http://troop101.net/base/newsletter/newsletter.asp?newsID=" & News_ID & " To view this newsletter."

 
	Set cdoMessage = CreateObject("CDO.Message")  
 
	With cdoMessage 
		Set .Configuration = cdoConfig 
		.CreateMHTMLBody MHTMLBody
		.From = "[email protected]" 
		.To = "[email protected]"
		.Subject = "Troop 101 Alumni Newsletter"
		.TextBody = msgstring 
		.Send 
		End With 

Set cdoMessage = Nothing  
Set cdoConfig = Nothing 
if err = 0 then
	Response.write("Messages Sent!")
	end if
%>


This code has worked perfectly for me until just recently when I sent it out to others. They received white text on white background, and could not read the email. The email should have had a blue background on it with the white text.

I thought by declaring MHTMLBody I was getting the page as it appears online, and for me it worked. Thinking some might have web elements blocked I thought I would send a msgstring to them with the site link. This link did not appear on any of the emails, and some received the white text on white background.

I guess my question is, is there anything wrong with the code I am sending, or is there a way to make that better? Or do you think it would be best to just send everyone a link to the newsletter instead of trying to get the problem fixed. Thanks for all the help.

Edited by Immortalarena, 11 June 2008 - 09:16 AM.

  • 0

Advertisements


#2
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
Have no idea or suggestions for this, but if this is the online string for the newsletter:
http://troop101.net/base/newsletter/newsletter.asp?newsID=&%20News_ID

then I do get a dark blue page with the logo along with this message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'newsletter.newsID ='.

/base/newsletter/newsletter.asp, line 24


Maybe you can figure it out from there or let me know if that's suppose to be the link to the online newsletter.

Ron

Edited by Major Payne, 11 June 2008 - 04:27 PM.

  • 0

#3
Immortalarena

Immortalarena

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 216 posts
The newsID is a variable in the page, an actual newsletter is as follows:

http://troop101.net/...er.asp?newsID=9


And as I said, some people get it fine, the others just get white on white.
  • 0

#4
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
Might ask those that don't get it or get it with white on white whether they have their Options set to not load images. This may just produce the white text on a default white background.

Ron
  • 0

#5
Immortalarena

Immortalarena

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 216 posts
Thanks,

Since, I can't control others email pref's, is there a way for the message to determine and post just a link if they have images set not to load?

Thanks again.
  • 0

#6
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
It possibly could be done, but exactly how is beyond what I normally do. Will see if I can get someone to take another look at your post.

Ron
  • 0

#7
Immortalarena

Immortalarena

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 216 posts
Thanks! :)
  • 0

#8
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
Post help request for your problem in the Tech Assist section. Good luck. Sorry I couldn't help further.

Ron
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP