Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2003-03-29
18
Medium Priority
?
674 Views
Last Modified: 2013-12-24
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>
0
Comment
Question by:jcperez2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
  • 2
  • +2
18 Comments
 
LVL 12

Expert Comment

by:jyokum
ID: 8233095
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
 
LVL 17

Accepted Solution

by:
anandkp earned 1400 total points
ID: 8234412
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
 
LVL 1

Expert Comment

by:Ken-doh
ID: 8238566
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
Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

 
LVL 17

Expert Comment

by:anandkp
ID: 8243300
Ken-Doh - how is ur comment diff from mine ???
& to top it off - u claim it to be an answere !
0
 
LVL 1

Expert Comment

by:Ken-doh
ID: 8243938
cause i gave code :P

lol sorry mate i didnt even read ur comments lol
0
 
LVL 17

Expert Comment

by:anandkp
ID: 8245590
jcperez2000 - ne-luck yet
r thigns working for u ???

let me know
K'Rgds
Anand
0
 
LVL 1

Expert Comment

by:Ken-doh
ID: 8245665
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
 
LVL 17

Expert Comment

by:anandkp
ID: 8247100
WOW :)
0
 
LVL 1

Expert Comment

by:Ken-doh
ID: 8247129
:)

0
 
LVL 17

Expert Comment

by:anandkp
ID: 8251276
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
 
LVL 1

Expert Comment

by:Ken-doh
ID: 8253417
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
 
LVL 17

Expert Comment

by:anandkp
ID: 8258892
yap figured that out !

simply awesome !!!

Cheers :)
Anand
0
 
LVL 1

Expert Comment

by:Ken-doh
ID: 8326199
doh u got the wrong answer :P

you can determine the clients set up

doh !!!
0
 

Author Comment

by:jcperez2000
ID: 8326252
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
 
LVL 17

Expert Comment

by:anandkp
ID: 8326315
yeah i think ken-doh shld also get credit for this !
his answere is a better option !

K'Rgds
Anand
0
 
LVL 1

Expert Comment

by:Ken-doh
ID: 8326753
yay :)

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

thank you
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question