When you use the cfpop
tag with action="GetAll"
, ColdFusion returns the same columns as with getheaderonly
, plus the following additional columns:
attachmentpath
attribute.)
If the message is multipart, the htmlbody and textbody fields contain the contents of the HTML and plain text parts, and the body field has the first part in the message. If the message has only one part, the body contains the message, and either the htmlbody or textbody field, depending on the message type, also has a copy of the message.
<html> <head><title>POP Mail Message Body Example</title></head> <body> <h2>This example adds retrieval of the message body:</h2> <cfpop server="mail.company.com" username=#myusername# password=#mypassword# action="GetAll" name="Sample"> <cfoutput query="Sample"> MessageNumber: #HTMLEditFormat(Sample.messageNumber)# <br> To: #Sample.to# <br> From: #HTMLEditFormat(Sample.from)# <br> Subject: #HTMLEditFormat(Sample.subject)# <br> Date: #HTMLEditFormat(Sample.date)#<br> Cc: #HTMLEditFormat(Sample.cc)# <br> ReplyTo: #HTMLEditFormat(Sample.replyTo)# <br> <br> Body:<br> #Sample.body#<br> <br> Header:<br> #HTMLCodeFormat(Sample.header)#<br> <hr> </cfoutput> </body>
</html>
<cfpop server="mail.company.com" username=#myusername# password=#mypassword#
This example does not use a CFML function to encode the body contents. As a result, the browser displays the formatted message as you would normally see it in a mail program that supports HTML messages.