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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Name in CFMAIL From/To 1

Status
Not open for further replies.

tleish

Programmer
Jan 17, 2001
619
US
Anyone know how to put a name into a from/to parameters in <CFMAIL> ?

I tried the following, but CF didn't even send the email because it didn't recognize the email address as valid:

<CFMAIL FROM=&quot;Bob Johnson <
Code:
bjohnson@email.com
>&quot;

TO=&quot;Tim Doolittle <
Code:
tdoolittle@email.com
>&quot;

SUBJECT=&quot;Test Email&quot;>

This is a test
</CFMAIL> - tleish
 
try this:

<CFMAIL FROM=&quot;bjohnson@email.com&quot;
TO=&quot;tdoolittle@email.com&quot;
SUBJECT=&quot;Test Email&quot;>
This is a test
</CFMAIL> Sylvano
dsylvano@hotmail.com
 
I'm aware of putting emails only in the from/to. That's not what I'm trying to accomplish. I want the Names in the from and to as well. I've seen this done in other languages (ie: ASP, PHP) I just don't know how to do it in CF. - tleish
 
tleish,

Are you looking for the &quot;friendly&quot; names that appear on the email?

This works for me:

<cfmail to=&quot;&quot;&quot;John Smith&quot;&quot;<jsmith@nowhere.com>&quot; from=&quot;&quot;&quot;Cool Guy&quot;&quot;<cguy@somewhereelse.com>&quot;
 
CFDude, your email led me to find that both of these examples worked. I don't know why it didn't work for me before. Thank you for the help.

<CFMAIL FROM=&quot;Bob Johnson<
Code:
bjohnson@email.com
>&quot;

TO=&quot;Tim Doolittle<
Code:
tdoolittle@email.com
>&quot;

SUBJECT=&quot;Test Email&quot;>

This is a test
</CFMAIL>

<CFMAIL FROM=&quot;&quot;&quot;Bob Johnson&quot;&quot;<
Code:
bjohnson@email.com
>&quot;

TO=&quot;&quot;&quot;Tim Doolittle&quot;&quot;<
Code:
tdoolittle@email.com
>&quot;

SUBJECT=&quot;Test Email&quot;>

This is a test
</CFMAIL> - tleish
 
Hey you're right! (I haven't really used it much before) I am using CF 5 and the code I had has been around for a while. I could have sworn that I had a hard time getting it to work in a 4.x version, so the additional quotes may be needed for a prior version (?) At any rate, I like yours a lot better -- much cleaner.

Tim P.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top