tags:

views:

340

answers:

3

I can't believe I've never noticed this before, but it seems that CFMail won't send to an email address that isn't explicitly set up on the destination mailserver.

This means that if I'm using '[email protected]' and have that set up to catch all email on the domain, CFMail won't send to '[email protected]'.

This causes a massive amount of problems for me, as I'm using CFMail to send out order confirmations, member activations and all manner of other bits and pieces.

Whatever your views on using catchall addresses, it can't be denied that people do use them So, in any case that a user enters a made-up address into one of my sites, they won't receive their email.

There must, simply MUST be a way around this - can anyone help?

For refernece, the message that appears in the logs when sending to a catchall address is 'Invalid Addresses'.

EDIT: Here's the CFMail syntax I'm using -

<cfmail to="#Arguments.sEmailAddress#" from="#Application.sAppEmailAddress#" subject="Stock reminder confirmation: #Local.qGetProductDetails.sProductName# - #Application.sCompanyName#" type="HTML" server="#Application.sAppEmailServer#" username="#Application.sAppEmailAddress#" password="#Application.sAppEmailPassword#">

Translates into:

<cfmail to="[email protected]" from="[email protected]" subject="Stock reminder confirmation: Some product - My Company" type="HTML" server="mail.mydomainname.com" username="[email protected]" password="XXXXXX">

All works fine for [email protected] but not for [email protected].

Important to note of course, that the catch-all is working correctly in all other respects, test emails from mail clients work perfectly.

+2  A: 

Can I see your CFMAIL tag setup? CFMAIL doesn't care as long as the email address is properly formatted.

Sean Coyne
Sure, I've added a code example to my question.
Gary
Are you sure #Arguments.sEmailAddress# translates to what you think it does? Can you <cfdump var="#arguments#" /><cfabort /> and see what you get? Perhaps it isn't the value you think it is. Also, have you tried hard coding the value you want as a test? Does it work then? If so then I think the variable doesn't contain what you think it does.
Sean Coyne
I've hard coded the value and it does the same [email protected] = works [email protected] = error - no email sent.The error in the mail.log reads:"Error","scheduler-0","08/05/09","16:57:55",,"Invalid Addresses"I can happily send to both addresses using outlook express, on the same server or from another server.
Gary
can you turn up the debugging level on the mail log to see if you get more info? it doesnt really make sense, i send emails to/from "non-real" email addresses every day
Sean Coyne
That's not really an issue with CFMAIL. Once CF has generated the file to the output spool CFMAIL is no longer involved. At that point it's the negotiation between the CF mail scheduler and the SMTP server.
Al Everett
The reason that CF can't send from [email protected] is probably because your SMTP server is refusing. Some mailservers will refuse to send from or to local addresses that do not exist. There may be settings on your SMTP server that will allow this.
Ben Doom
+6  A: 

Its not ColdFusion that cares about email validity, its the SMTP server. CF only cares about well formed email addresses.

If you initiated a telnet session to your mail server and tried to use the same address, I'm sure it would have the same result.

Debugging tips for SMTP Connectivity: http://www.talkingtree.com/blog/index.cfm/2004/11/22/debug-smtp

Steven Erat
I've telnetted to the mail server from the coldfusion server, with no issues.
Gary
+1  A: 

Urgh!

Turns out it was an issue with the server. For some reason, catchall email accounts serverwide had stopped working properly. After an email to my hosting provider, it's all working fine with no code changes.

They're somewhat cagey as to what caused the issue, and I was still able to use an email client to send mail out to the addresses...

Thanks for the help in any case. ;)

Gary