Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Used ASP to read HTML file and send email, but ASP removes period.

Status
Not open for further replies.

skurpyun

Programmer
Jun 19, 2002
60
US
Ok, the header is already too long.
But this is the story.

I wrote a script that reads an HTML file using the FileSystemObject and puts the result into a variable "strBody". Then, also using ASP, I email the contents of the variable "strBody" in the body of an MHTML email (one of those emails that come in html format with images and pretty colours, blah, blah, blah). I use this script to send MHTML emails for a client of mine to their clients (no, no, no....i'm not spamming here!!).

Ok so far. Now the HTML file contains href links with the text of the href tag containing the domain name (i.e.
Code:
<a href='[URL unfurl="true"]http://wwww.domain.com'>domain.com</a>[/URL]
). What i have noticed when looking at the sent email is that the same text within the href tags is modified with the period (&quot;.&quot;) before the &quot;com&quot; removed. So in the email, it looks like this &quot;domaincom&quot; and not &quot;domain.com&quot;.

So here goes my question/comment/'what the..' statement: Why did the period in &quot;domain.com&quot; get removed????? Has this happened to anyone else? Does anyone know why? Does anyone have a solution?

Now here's what really boggles me. In the HTML code for the file I read using the FileSystemObject, i put bold tags around the links. So that i get
Code:
<a href=&quot;[URL unfurl="true"]http://www.domain.com&quot;><b>domain.com</b></a>[/URL]
.
And when I use that, the text for the link in the email comes out fine. That is, in the email i get domain.com and not domaincom.

What the......???

Anyone have any idea? Here's some code:

Code:
dim objFile, objEmail

filepath= &quot;C:/folder/file.html&quot;

set objFile = server.createObject(&quot;Scripting.FileSystemObject&quot;)

if objFile.FileExists(filepath) then
	set objTextStream = objFile.OpenTextFile(filepath)
	strBody = objTextStream.ReadAll()
end if

objTextStream.close
set objTextStream = nothing
set objFile = nothing

set objEmail = server.createobject(&quot;CDONTS.NewMail&quot;)
	with objEmail
		.To = to_email
		.From = &quot;webmaster@domain.com&quot;
		.Subject = &quot;Newsletter Test&quot;
		.MailFormat = CdoMailFormatMail
		.BodyFormat = CdoBodyFormatHTML
		.Body = strBody
		.Send
	end with
set objEmail = nothing


The above code is what i used. It's pretty standard, no weird stuff, no 'way-out-there' kinda stuff. Just standard code.
Your help/commiseration/general thoughts would be greatly appreciated.
thanks.:)
 
before sending the message try printing the strBody, this will check whether the problem is in the ASP code....

Known is handfull, Unknown is worldfull
 
I think that in you file you should change the following line:
<a href=&quot;
and by the way, read this article it was helpful for me, I never get such problems.

Maybe you have to change those lines too, (like in the article, that what I personally used):
.MailFormat = 0
.BodyFormat = 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top