Need help with CFMAIL tag, need to format in text and html....

I'm relatively new to CF.  I am trying to set up a Send A Link. For the most part it is working fine with the exception of CFMAIL.  Here'is how the Send-A-Link is setup.  (1) User Fills out the Form, (2) Mailit.cfm processes the CFMAIL tag and displays the Confirmation page.  I've successfully edited the confirmation page. However, the CFMAIL aspect of Mailit.CFM needs attention. What I'd really like have in the body of the email is an HTML format that I've created. For some reason, however, Type="HTML" is not working form me. Nontheless, I need a way to (1) have CF deternmine whether or not a mail client has HTML on or off and if off for it to send the text email equivalent, and (2) hava a text and HTML version for the outgoing message.  The code below is what I have so far. On the HTML aspect I'd like CF to write the #title# shown as a hyperlink to #wmURL#. I've also attached an HTML idea--provides a good idea of what I'm looking for....

Thank you

Charlie Perez

--------------------------------------------

<HEAD>
<CFPARAM name="wmFrom" DEFAULT="">
<CFPARAM name="wmSubject" DEFAULT="FairTaxUSA.Org">
<CFPARAM name="wmBody" DEFAULT=" ">
<CFPARAM name="wmMail" DEFAULT=" ">
<CFPARAM name="wmURL" DEFAULT=" ">

<CFMAIL FROM="NewsRoom@FairTaxUSA.Org"
        TO="#wmTo#"
        BCC="charlie@heloc.net"
        SUBJECT="A suggested website (#wmSubject#) from #wmFrom#"
            SERVER="mail.heloc.net">
Your friend #wmFrom# (#wmMail#) wanted you to know about this website:

#wmURL#

Here's what they had to say about it:
===========================================================
#wmBody#
===========================================================

Be sure to visit soon!

This message was generated by the URL referral service at yoursite.com.
If you received this message in error, please contact <a
href="mailto:#wmMail#">#wmMail#</a> or the
webmaster at http://yoursite.com.

</CFMAIL>



</HEAD>

--------------------------------------------
Proposed HTML FILE

<HTML>

<HEAD>


<STYLE TYPE="TEXT/CSS">
body {  background-color: #FFFFFF}
.font-cn {  font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #000000}
.font-gr {  font-family: Arial, Helvetica, sans-serif; font-size: 9px; color: #666666}
.fontbold { font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; font-size:11px;color: #000000}
.fontsponsor { color: #333399; font-weight: bold ; font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;}
.fontlargebold {font-size:12px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif;}
.fontspacer { font-size: 5px }
</STYLE>

</HEAD>

<BODY bgcolor="#FFFFFF" link="#000099 vlink="#000099" alink="#000099">
<TABLE width="487" border="0" cellspacing="0" cellpadding="2" bgcolor="#000000">
      <TR>
      <TD>
      <TABLE width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
        <TR bgcolor="#000066">
          <TD height="12" colspan="2">&nbsp;</TD>
        </TR>
        <TR>
          <TD width="1%">&nbsp;</TD>
          <TD width="99%"> <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
              <TR>
                <TD>&nbsp;LOGO
                  <table cellspacing="0" cellpadding="0" border="0">
                    <tr>
                      <td align="right" class="font-cn">&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                  </table>
                  <strong><font size="1" face="Arial, Helvetica, sans-serif">* Please note, the sender's email address
                  has not been verified.</font></strong></TD>
              </TR>
            </TABLE></TD>
        </TR>
        <TR>
          <TD colspan="2" class="fontbold">&nbsp;</TD>
        </TR>
        <TR>
          <TD bgcolor="#000000" colspan="2"></TD>
        </TR>
        <TR bgcolor="#FFFFFF">
          <TD><font color="#FFFFFF">&nbsp;</font></TD>
          <TD><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">Your
            friend <strong>#wmFrom#,</strong> (#wmMail#) wanted you to know about
            this website:</font><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></TD>
        </TR>
        <TR>
          <TD bgcolor="#CCCCCC">&nbsp;</TD>
          <TD bgcolor="#CCCCCC"><font size="2" face="Arial, Helvetica, sans-serif">This
            is what they thought:</font></TD>
        </TR>
        <TR>
          <TD bgcolor="#CCCCCC">&nbsp;</TD>
          <TD bgcolor="#CCCCCC"> <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
              <TR>
                <TD class="fontbold"> <BR>
                  #wmBody#&nbsp; <BR> </TD>
                <TD width="13">&nbsp;</TD>
              </TR>
            </TABLE></TD>
        </TR>
        <TR>
          <TD bgcolor="#CCCCCC">&nbsp;</TD>
          <TD bgcolor="#CCCCCC">&nbsp;</TD>
        </TR>
        <TR>
          <TD bgcolor="#000000" colspan="2"></TD>
        </TR>
        <TR>
          <TD>&nbsp;</TD>
          <TD>&nbsp;</TD>
        </TR>
        <TR>
          <TD>&nbsp;</TD>
          <TD class="fontbold">Click the following to access the sent link:</TD>
        </TR>
        <TR>
          <TD class="fontspacer">&nbsp;</TD>
          <TD class="fontspacer">&nbsp;</TD>
        </TR>
        <TR>
          <TD>&nbsp;</TD>
          <TD> <div align="center"><a href="#wmURL#">Title From The Reffered Page</a>
              * </div>
            <TABLE width="100%" border="0" cellspacing="0" cellpadding="2">
              <TR>
                <TD valign="top" class="fontlargebold"> <div align="center"></div></TD>
              </TR>
            </TABLE>
            <TABLE width="100%" border="0" cellspacing="0" cellpadding="2">
              <TR>
                <TD><div align="center"><font color="#990000" size="2" face="Arial, Helvetica, sans-serif">We
                    thank you in advance for visiting &quot;FairTaxUsa.Org.&quot;</font><br>
                  </div></TD>
              </TR>
            </TABLE>
          </TD>
        </TR>
        <TR>
          <TD>&nbsp;</TD>
          <TD class="font-gr"><p>This message was generated by the URL referral
              service at yoursite.com. If you received this message in error,
              please contact our <a href="maito:webmaster@fairtaxusa.org">webmaster</a>
              or visit us at<a href="http://www.fairtaxusa.org"> http://www.fairtaxusa.org</a>.
              &nbsp; </p>
            <p>*This article can also be accessed if you copy and paste the entire
              address below into your web browser.<br>
              #wmURL#l </p>
            <p><br>
              <br>
            </p></TD>
        </TR>
      </TABLE>
      </TD>
      </TR>
</TABLE>

<p>&nbsp;</p></BODY>
</HTML>
jcperez2000Asked:
Who is Participating?
 
anandkpConnect With a Mentor Commented:
ok - i hope i am getting u right here

1. u cannot determine clients email behavious [html/text]
2. u'll need to ask each user - as to if he wants to recieve HTML mails / TEXT mails
3. using this option - u can decide what type of email needs to be send to that user.

4. have a CFIF condition - for sending diff email formats
5. if its a HTML mail - ur format shld work ... just paste the entire HTML body of email inside the <cfmail> ... </cfmail>

6. but if u r sending in a text mail - the hyperlinks wont work & so wont the table.
7. so u'll need to get rid of the formatting from the email & send links as :-
dear user pls copy & paste this link in ur browsers address bar http://www.experts-exchange.com/
8. thats how u'll need to manage both HTML & TEXT clients !

let me know if u need more help on this

K'Rgds
Anand
0
 
jyokumCommented:
You won't be able to detect what format the client will handle, all you can do is hope they can deal with whatever format you send them properly.

Here's a cfmail example that properly sends HTML format (obviously you'll have to fix the addresses and server info):

<cfmail from="who@ami.net" to="myaddress@somewhere.com" subject="HTML message" type="html" server="mail.ami.net">
<html>
<head>
<title>HTML message</title>
</head>

<body>
<table border="1">
     <tr>
          <td>this is a test</td>
     </tr>
</table>
</body>
</html>
</cfmail>
0
 
Ken-dohCommented:
OKAY I have u an answer

it is possible to get an HTML OR Txt email.

you simpley create 2 emails 1 in text and 1 in HTML

then in the email header you have a line of code that checks if the client can use HTML or text and then displays the correct type

:)

here is my code


<cfmail to="matt.kennedy@coastdigital.co.uk" from="matt.kennedy@coastdigital.co.uk" subject="#contact_email#" type="HTML">
<cfmailparam name="MIME-Version" value="1.0">
<cfmailparam name="Content-Type" value="multipart/alternative; boundary=""sp_mailer-multipart_boundary_____________""">
--sp_mailer-multipart_boundary_____________
Content-Type: text/plain;
 
#no_html#
 
--sp_mailer-multipart_boundary_____________
Content-Type: text/html;
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 
<html>
<head>
 
 <style>
 td, p {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 11px;
 line-height: 16px;
 color: 000000;
 text-decoration: none;
 }
 </style>
</head>
 
<body leftmargin=0 topmargin=0>
 
<table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="#application.url_address#/email/banner_logo.gif" width="200" height="71" border="0"></td>
    <td align="right">test</td>
        </tr>
</table>
<table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="#application.url_address#email/email_banner.jpg" width="600" height="74" alt="Click here to visit" border="0"></td>
        </tr>
</table>
</td></tr></table>
 
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
 <td>#form.email_bodytext#</td>
</tr>
</table>
 
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
 <td><p>DISCLAIMER.</p><br>
</td>
</tr>
</table>
<table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="#application.url_address#email/banner_bot.gif" width="600" height="26" border="0"></td>
        </tr>
</table>
 
</body>
</html>
--sp_mailer-multipart_boundary_____________--
</cfmail>
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
anandkpCommented:
Ken-Doh - how is ur comment diff from mine ???
& to top it off - u claim it to be an answere !
0
 
Ken-dohCommented:
cause i gave code :P

lol sorry mate i didnt even read ur comments lol
0
 
anandkpCommented:
jcperez2000 - ne-luck yet
r thigns working for u ???

let me know
K'Rgds
Anand
0
 
Ken-dohCommented:
OH my answser is diff 2 yours btw


my answer says u write 2 emails 1 in text 1 in html and send BOTH to the user in 1 email

my mail headers then display the correct email


1. u cannot determine clients email behavious [html/text]

YES YOU CAN

<cfmailparam name="MIME-Version" value="1.0">
<cfmailparam name="Content-Type" value="multipart/alternative; boundary=""sp_mailer-multipart_boundary_____________""">
--sp_mailer-multipart_boundary_____________

HTML

--sp_mailer-multipart_boundary_____________
Content-Type: text/html;

TEXT

therefore i am not saying what ur saying I am saying a much better solution !!!!

0
 
anandkpCommented:
WOW :)
0
 
Ken-dohCommented:
:)

0
 
anandkpCommented:
i wld just like to point out one thing
i mentioned u cannot determine clients email behavour - right !

if u say u can - then y do u have both the formats of mails being send - y cant u send only one depending on clients email behaviour ???

Cheers
Anand
0
 
Ken-dohCommented:
ok.

you send both versions in 1 email

then the email client examines the email headers

if the email client can display HTML it will display the HTML mail.

if it cant display HTML it will switch and display the TXT email

so the client determines which version to check.

we use this code and its great :)


you can only determine the clients email when the email is on their machine so it does this then.

make sense???
0
 
anandkpCommented:
yap figured that out !

simply awesome !!!

Cheers :)
Anand
0
 
draypCommented:
0
 
Ken-dohCommented:
doh u got the wrong answer :P

you can determine the clients set up

doh !!!
0
 
jcperez2000Author Commented:
I am new to this group and programming altogether. I'm learning quite a bit and this is what I was trying to do. I wanted to award you the same amount of credits as the initial person that answered. But evidently experts-exchange does not offer this choice.  What would be easiest way for me to credit your account?

THank You,

Charlie
0
 
anandkpCommented:
yeah i think ken-doh shld also get credit for this !
his answere is a better option !

K'Rgds
Anand
0
 
Ken-dohCommented:
yay :)

open up a new question called points for ken-doh and allocate however many points you feel like donating :)

thank you
0
All Courses

From novice to tech pro — start learning today.