Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 23rd, 2004, 08:16 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default HTML formatted mail goes to BadMail. Why?

Hi,
I'm using FSO. When sending values of a form to email (using CDONTS),
in plain text, the mail is created and sent. WEhen requesting the same values in an HTML formatted mail (with tables) it goes to the BadMail folder. Why?
Here's the code in my asp page:
*********************************
Dim ObjMail
Dim HTML
Set ObjMail = Server.CreateObject("CDONTS.NewMail")

HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Commercial Proposal Request</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""#FFFFFF"" font size=""1"" face = ""Verdana"">"
HTML = HTML & "<TABLE width=""100%"" border=""1"" cellspacing=""0"" cellpadding=""0"">"
HTML = HTML & "<tr>"
HTML = HTML & "<td colspan=""5"" bgcolor=""#6699FF"" color=""#FFFFFF"">"
HTML = HTML & "<strong>CONTACT INFORMATION</strong>"
HTML = HTML & "</td>"
HTML = HTML & "</TR>"

HTML = HTML & "<tr>"
HTML = HTML & "<td width=""24%"" nowrap align=""left"">" & t1name & "</td>"
HTML = HTML & "<td width=""22%"" align=""right"">"& t1 &"</td>"
HTML = HTML & "<td width=""25"">&nbsp;</td>"

and so on and so on...
*********************************

Heres the code in the header of the BAD file:
*********************************
X-Receiver: someone@brother.ca
X-Receiver: nancy.stefanik@brother.ca
To: <soemone@brother.ca>
Cc: <nancy.stefanik@brother.ca>
Subject: COMMERCIAL PROPOSAL Request
Date: Fri, 20 Aug 2004 13:45:04 -0400
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="----=_NextPart_000_0004_01C486BB.E5E2F840"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441

This is a multi-part message in MIME format.

------=_NextPart_000_0004_01C486BB.E5E2F840
Content-Type: text/plain;
    charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

CONTACT INFORMATION
Rep. Name: sadsd
*********************************

Is it the "Content-Transfer-Encoding: 7bit" that is causing the
problem?

Any help would greatly be appreciated
Thanks
Nancy
 
Old August 23rd, 2004, 09:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Nancy,

How about giving that to your email address? Looks like that causes the error. Is that "soemone@brother.ca" a valid/exisiting ID?

_________________________
- Vijay G
Strive for Perfection
 
Old August 23rd, 2004, 09:27 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Happygv,
I changes those addresses to valid one: and here is the results (in BADmail, unfortunately)

**********************************
X-Receiver: webmestre@brother.ca
X-Receiver: nancy.stefanik@brother.ca
To: <webmestre@brother.ca>
Cc: <nancy.stefanik@brother.ca>
Subject: COMMERCIAL PROPOSAL Request
Date: Mon, 23 Aug 2004 09:23:02 -0500
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="----=_NextPart_000_0000_01C488F2.CA1F5250"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C488F2.CA1F5250
Content-Type: text/plain;
    charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

(...and the body of the mail more or less formatted)

************************************************** *

At the bottom of this file, (after the body of the mail has been written )

Is the following:

************************************************
------=_NextPart_000_0000_01C488F2.CA1F5250
Content-Type: text/html;
    charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC"-//IETF//DTD =
HTML//EN"><html><head><title>Commercial Proposal =
Request</title></head><body bgcolor=3D"#FFFFFF" font size=3D"1" face =3D =
"Verdana"><TABLE width=3D"100%" border=3D"1" cellspacing=3D"0" =
cellpadding=3D"0"><tr><td colspan=3D"5" bgcolor=3D"#6699FF" =
color=3D"#FFFFFF"><strong>CONTACT INFORMATION</strong></td></TR><tr><td =
width=3D"24%" nowrap align=3D"left">

(... and so on)

***********************************

the funny thing is that nowhere in my physical code have I coded the "3D" we find everywhere...


Thanks Vijay.
 
Old August 23rd, 2004, 10:03 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Just trying all possibilites.

How about doing a Response.Write HTML before sending it out?
Code:
Response.write HTML
Response.end
and see if you could see all the content there.

Can that "HTML" variable be given someother name, like strHTML?

Try removing this line
HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 23rd, 2004, 12:55 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Vijay,

Why would you want to change the variable?
:"Can that "HTML" variable be given someother name, like strHTML?
"

ANyway, I did.
And this is what I found in the Badmail folder:
************************************************
X-Receiver: webmestre@brother.ca
X-Receiver: nancy.stefanik@brother.ca
To: <webmestre@brother.ca>
Cc: <nancy.stefanik@brother.ca>
Subject: COMMERCIAL PROPOSAL Request
Date: Mon, 23 Aug 2004 12:50:19 -0500
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="----=_NextPart_000_0008_01C4890F.BEB56450"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441

This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C4890F.BEB56450
Content-Type: text/plain;
    charset="iso-8859-1"
Content-Transfer-Encoding: 7bit


------=_NextPart_000_0008_01C4890F.BEB56450
Content-Type: text/html;
    charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC"-//IETF//DTD HTML//EN">
------=_NextPart_000_0008_01C4890F.BEB56450--
************************************************

That's all.

I tried removing the "<!DOCTYPE HTML PUBLIC"-//IETF//DTD HTML//EN">
" portion and this is what I received (in my badmail, again)


************************************************** **

X-Receiver: webmestre@brother.ca
X-Receiver: nancy.stefanik@brother.ca
To: <webmestre@brother.ca>
Cc: <nancy.stefanik@brother.ca>
Subject: COMMERCIAL PROPOSAL Request
Date: Mon, 23 Aug 2004 12:52:11 -0500
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="----=_NextPart_000_000C_01C48910.01814E70"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441

This is a multi-part message in MIME format.

------=_NextPart_000_000C_01C48910.01814E70
Content-Type: text/plain;
    charset="iso-8859-1"
Content-Transfer-Encoding: 7bit


------=_NextPart_000_000C_01C48910.01814E70
Content-Type: text/html;
    charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


------=_NextPart_000_000C_01C48910.01814E70--

**********************************************

I'm not sure what to do so that it stops going to the badmail folder and writes to the E-mail Client??



 
Old August 23rd, 2004, 01:01 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Vijay,
I tried the response.write (strHTML)

and it displayed nothing in the page.

Here's the call to the code:
*************************************************
Dim strHTML
strHTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Commercial Proposal Request</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""#FFFFFF"" font size=""1"" face = ""Verdana"">"
HTML = HTML & "<TABLE width=""100%"" border=""1"" cellspacing=""0"" cellpadding=""0"">"
HTML = HTML & "<tr>"
HTML = HTML & "<td colspan=""5"" bgcolor=""#6699FF"" color=""#FFFFFF"">"
HTML = HTML & "<strong>CONTACT INFORMATION</strong>"
HTML = HTML & "</td>"
HTML = HTML & "</TR>"

HTML = HTML & "<tr>"
HTML = HTML & "<td width=""24%"" nowrap align=""left"">" & t1name & "</td>"
HTML = HTML & "<td width=""22%"" align=""right"">"& t1 &"</td>"
HTML = HTML & "<td width=""25"">&nbsp;</td>"
HTML = HTML & "<td width=""24%"" nowrap align=""left"">" & t4name & "</td>"
HTML = HTML & "<td width=""22%"" align=""right"">" & t4 & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</BODY>"
HTML = HTML & "</HTML>"
Response.Write (strHTML)
%>

What am I doing wrong?
thanks for all your help!

 
Old August 23rd, 2004, 01:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

But you haven't changed that completely. Try this.

<%
Dim strHTML
strHTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
strHTML=strHTML & "<html>"
strHTML=strHTML & "<head>"
strHTML=strHTML & "<title>Commercial Proposal Request</title>"
strHTML=strHTML & "</head>"
strHTML=strHTML & "<body bgcolor=""#FFFFFF"" font size=""1"" face = ""Verdana"">"
strHTML=strHTML & "<TABLE width=""100%"" border=""1"" cellspacing=""0"" cellpadding=""0"">"
strHTML=strHTML & "<tr>"
strHTML=strHTML & "<td colspan=""5"" bgcolor=""#6699FF"" color=""#FFFFFF"">"
strHTML=strHTML & "<strong>CONTACT INFORMATION</strong>"
strHTML=strHTML & "</td>"
strHTML=strHTML & "</TR>"
strHTML=strHTML & "<tr>"
strHTML=strHTML & "<td width=""24%"" nowrap align=""left"">" & t1name & "</td>"
strHTML=strHTML & "<td width=""22%"" align=""right"">"& t1 &"</td>"
strHTML=strHTML & "<td width=""25"">&nbsp;</td>"
strHTML=strHTML & "<td width=""24%"" nowrap align=""left"">" & t4name & "</td>"
strHTML=strHTML & "<td width=""22%"" align=""right"">" & t4 & "</td>"
strHTML=strHTML & "</tr>"
strHTML=strHTML & "</table>"
strHTML=strHTML & "</BODY>"
strHTML=strHTML & "</HTML>"
Response.Write (strHTML)
Response.end
%>

_________________________
- Vijay G
Strive for Perfection
 
Old August 23rd, 2004, 01:11 PM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default

Nancy,
I found an article awhile back about emailing which covered most of my problems. I'm trying to find the article to forward to you.

Below is an exact copy of working code I use on my site where a user submits to a form for mailing and database storing. This code pulls information out of a database and sends to me.

<%
  Response.Buffer = "true"
  Dim strConnect, strMailer
  strMailer = "webmaster@co.harrison.ms.us"
%>

<!-- METADATA TYPE="typelib"
              FILE="c:\program files\common files\system\ado\msado15.dll" -->
<%
  Dim objRS, objComm, strID
  strID = Request.Querystring("id")

  Set objComm = Server.CreateObject("ADODB.Command")
  objComm.ActiveConnection = strConnect
  objComm.CommandText = "SELECT * FROM feedback WHERE id = " & strID
  objComm.CommandType = adCmdText
  Set objRS = objComm.Execute
  Set objComm = Nothing

  Dim strFirst, strLast, strPhone, strEmail, strContact, strCat, strMemo, strFrom, strAddedon
  strFirst = objRS("first")
  strLast = objRS("last")
  strPhone = objRS("phone")
  strEmail = objRS("email")
  strContact = objRS("contactu")
  strCat = objRS("catagory")
  strMemo = objRS("memo")
  strFrom = objRS("from")
  strAddedon = objRS("addedon")

  strSubject = "Harrison County Online! Feedback Form Submission"
  strBody = "<HTML>" & _
             "<HEAD>" & _
             "</HEAD>" & _
             "<BODY>" & _
             "<table align=left border=0 cellpadding=0 cellspacing=0 width=500>" & _
             "<tr><td align=left width=500 colspan=3><img src='http://co.harrison.ms.us/site/feedback/mailer.gif'><p></td></tr>" & _
             "<tr><td align=right width=100 bgcolor=dddddd><b>Name:</b></td>" & _
             "<td align=left width=5></td>" & _
             "<td align=left width=395>" & strFirst & " " & _
             strLast & "</td></tr>" & _
             "</table>"

  Set objMail = Server.CreateObject("CDONTS.NewMail")

  objMail.From = strEmail
  objMail.To = strMailer
  objMail.Subject = strSubject
  objMail.Body = strBody

  objMail.MailFormat = 0
  objMail.BodyFormat = 0

  objMail.Send
  Set objMail = Nothing

  Response.Redirect "thankyou.asp"
%>

Don't know if this will help you at all, but it did save me a lot of hair pulling at the time. I have noticed 2 other issues with FSO.
1) The sender's email must be valid
2) You may have an issue with mail relaying.

Just my 2 cents.
 
Old August 23rd, 2004, 01:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Nancy,

1) That is the reason, I asked you if the TO address is a valid one. If that is valid, then the second one is what I am trying to figure out.

2) If your HTML content of the body has something that could filter the mail as SPAM/BAD email. Thats why trying to see, if HTML has something fishy. So posibilly, the relay thing should be the issue here.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 23rd, 2004, 03:17 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Vijay, the code you reccommended so that the response.write (for testing purposes) worked!!

So how do I get this format into the email.

Thanks all,
Looking forward to your advice,
Nancy






Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML formatted text via xsl templates? beckfield XSLT 2 February 26th, 2005 01:48 PM
Send Mail from Word with formatted Body saimen Excel VBA 1 February 10th, 2005 07:53 AM
Sending a CSS formatted HTML mail madhukp Classic ASP Basics 4 June 17th, 2004 11:30 PM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM
Formatted/HTML text pkgal79 HTML Code Clinic 2 June 18th, 2003 02:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.