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

CFMAIL - Replying

Status
Not open for further replies.

happyb

Programmer
Oct 25, 2000
29
0
0
AU
Hi

I need some help replying with CFMAIL tags. I have created code to send and recieve mail through CF tags. Now I want to set it up to Reply to messages that I have in my inbox. Now when I do this CFMAIL does not send the reply.

The reason for this is because in order to reply to the sender, I take the senders information 'HTMLCodeFormat(From)' and transfer it to the 'To' field in my reply form. The problem is that the Senders information in the message is in the format of &quot;First Lastname&quot; <name@emailadddress.com>


Now this format is put in the value of the 'To' field in my Reply to Message form, becuase I tell it that the value is... 'HTMLEditFormat(From)'. But... the problem is that CFMAIL, ColdFusion won't send this message because of the extra characters, what I need to do is JUST display the email address, not the name and the quotations.


Can someone please help me with this???


Thanks for any help,

Happy :)
 
Try this

First:
<CFSET From=RemoveChars(From, 1, Find(&quot;<&quot;, From, 1))>
This strips everything upto and including the < character

Next:
<CFSET From=RemoveChars(From, Find(&quot;>&quot;, From, 1), 1)>
This removes the trailing > character

Finally if you want you can do:
<CFSET From=Trim(From)>
This will remove leading and trailing spaces

The variable From should now contain only the email address

Hope this helps
 
Thanks Lachlan that sounded like the exact thing that I wanted for my code, the only problem is that I got this error message when I tried to use it.... am I missing something?

Thanks,
Emma

ERROR THAT I GOT:

Error Diagnostic Information
Cannot add value to query


The operation you have requested is invalid. Only query columns can be added to query objects. It is likely that you have omitted the indexing brackets of a query column you are trying to set.

For example, can produce this error message. The correct syntax is


The error occurred while evaluating the expression:


Message.From = RemoveChars(Message.From,Find(&quot;>&quot;,Message.From,1),1)

The error occurred while processing an element with a general identifier of (CFSET), occupying document position (69:1) to (69:75).

 
Try assigning the query value Message.From to a variable first e.g,
<CFSET MailFrom = '#Message.From#'>

then use MailFrom for the other operations e.g,
<CFSET MailFrom=RemoveChars(MailFrom, 1, Find(&quot;<&quot;, MailFrom, 1))>


any luck?
lachlan@cynaptic.net
 
That worked great!! Thanks!

I did have a problem that when I sent the reply to the sender, and then they sent back the reply to me for me to reply... CF would give me an error saying that the to field has now got a value of 0... this is becuase the reply to is now just an email... not the name and the <>, and it can't find the <> or it tries to remove what is left so... I did an CFIF statement before the RemoveChars statement. I told it to run the statement only if MailFrom CONTAINS &quot;<&quot;.

And it worked!! woohoo :)

Thanks for all your help!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top