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

CFPOP and (extra) Attachment Handling 1

Status
Not open for further replies.

jd77

Programmer
Jan 2, 2001
33
US
Hello,

I am trying to implement an email forwarding function. The problem I'm having is forwarding email received via CFPOP. I can receive and send email, along with all attachments just fine. The problem is that I always receive an extra attachment (even when no attachment was sent). This extra attachment appears to be an HTML copy of the body that I received in CFPOP. The attachment usually comes with no extension, and a name of C2, C3, C4, etc.

I am currently simply sending this attachment along with the original(s), but this can be confusing to the recipient.

I would like to know what this and how to correctly handle it. Also, does anyone have an example, or know of an example of mail forwarding that may also handle this issue? Any other known issues with mail forwarding would be helpful.

Thanks,

Joe


 
Hey Joe,

First, I would question why you're using CF to forward e-mail as this is really best done with the mail server configuration. If you need to intercept these or do some type of screening then what your describing makes sense but I wouldn't use CF for this if possible.

I would suspect, however, that the problem is with the code sending the e-mails (if done w/ CF) or with the mail server itself. There have been a number of bugs with the CF mail handling tags but I've never heard of this one. Could you post all pertinent code involved? I can take a look and verify on my system if needed.

GJ
 
Yes, I would love to use the mail server to forward as well! Unfortunately my tiny mail server does not provide this functionality. I’d love to know of a low cost one for Windows 2000 that does. Never the less, I do see a use for forwarding mail messages – even if the mail server does provide that feature. An example may be a programmatic forwarding of messages to users based on dynamic web activity, for example.

In any case, here is the CFPOP command I use:

<cfpop attachmentpath=&quot;c:\coldfusion\temp&quot;
messagenumber=#mailheaders_messagenumber#
username=&quot;userone&quot;
password=&quot;pword&quot;
server=&quot;server.com&quot;
action=&quot;GETALL&quot;
generateuniquefilenames=&quot;false&quot;
name=&quot;mail&quot;></cfpop>

If I send a message to my post office with a body of: “This is a test”
Then retrieve it using the above command I get the body, as expected:
This is a test

I also get an attachment named “A.” It is 327 bytes long. If I look at it with a text editor I see:

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML><HEAD>
<META http-equiv=Content-Type content=&quot;text/html; charset=iso-8859-1&quot;>
<META content=&quot;MSHTML 5.50.4134.600&quot; name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>This is a test</FONT></DIV></BODY></HTML>

It appears to be an HTML version of the text. I’m sure there is a logical explanation, but I don’t have one. The message was sent by Outlook Express. Perhaps Microsoft is doing something strange. In any case, most email programs seem to be able to handle it. It's probably an issue with CFPOP. It would be great to know how to utilize it or selectively eliminate it. At this point I don’t know of a way to discriminate between this and a valid attachment.

Thanks for the help,

Joe
 
Hey Joe,

I suspect the culprit is Outlook Express or possibly your e-mail server. We can do two things to either verify or eliminate these components as the problem. The first is for me to send an e-mail message to your address and see if the attachment is there. As I use Eudora light, I suspect you will not see an attachment. If you do however, I will then create a test account on my mail server so that you can check it with your cfpop code and I can verify the results on my side. This will then rule out your mail server if the same thing occurs with my server.

I suspect that we will find it's either your mail client or mail server as I've done some coding in the past week with cfpop and haven't had any problems with unnecessary attachments.

Let me know what e-mail address (create a new test account if you like) to send to and I'll drop you a test message.

GJ
 
I would guess the same. I patched together an address at tektiptest@yoy.org. Give it a try. Please send one with no attachments, and one with a small attachment if you can.

Thanks alot for your time,

Joe
 
Actually both messages bounced. It appears your server is rejecting external messages to that address. Do you want to try an account on my system?

GJ
 
Actually I received both messaages. I don't see an attachment in either. At this point I am guessing that it is a Microsoft issue. I still would like to know what the attachment is, but I think I will search for an inexpensive mail server that forwards.

Thanks,

Joe
 
Thanks, I'll look into it.

I also downloaded Merak and Slmail. They both seem to work fine. I'll test them with Coldfusion and see if I get the same problems. I'll post the results.

Joe
 
I installed the Merak Mail server. It does have the options I was trying to create. However, If I access an Outlook Express generated message that was sent to the mailserver via Coldfusion, CPOP I still get the strange HTML attachment. I am guessing that CFPOP does not handle this type of email message correctly. Anyone who can shed some light on why Outlook sees fit to add the attachment? It must be some sort of standard since most mail servers seem to handle it.

Joe
 
I think what you're seeing is some sort of attachment that is like a signature file. I use Eudora and I'm always having to clean out my attachment folder to get rid of .vcf and even .jpg files that some of the MS Outook clients send as a signature file. I think these are part of some newer mail standard that uses the attachment feature to send a customizable footer. Since cfpop adheres to the pop protocol, it can't just discard these attachments (assuming they are what I'm describing) since it has no way of knowing if they are genuine attachments you want or whether they are part of some footer info that a particular mail client will use.

In your case, I think you would want to forward these attachments back out unchanged as the recipients mail client will either use them for display purposes or save them off as files like my Eudora Light client. We could do some additional tests to confirm this but I suspect your code is working the way you would want.

GJ

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top