2

Okay, so this is a really weird issue that's really just confusing the crap out of me...

I have a number ColdFusion sites running on the same dedicated server and have been noticing some really strange issues with mail sent from some sites using the <cfmail> tag.

Here is an example of a mail tag being used with a form on one of the websites:

<cfmail to="#cfmail.clientEmail#" from="#form.email# <#form.email#>" replyto="#form.email#" server="#cfmail.server#" username="#cfmail.username#" password="#cfmail.password#" subject="Request for info - #form.propertyName#" type="HTML" port="#cfmail.port#" useSSL="#cfmail.useSSL#">

(All of the cfmail scoped vars are being set in the Application file)

I do it this way so that the individual sites are not all using the in-house mail server, and instead use their own Google Apps account (DNS is set up properly).

Form submits, email sends, email is delivered...no problem, right?

Well...that's when things get funky.

Notice the FROM looks like this in the code:

from="#form.email# <#form.email#>

When delivered, it looks like this:

FROM : bob@someaddress.com <info@somerandomdomain.com>

When it SHOULD look like this:

FROM : bob@someaddress.com <bob@someaddress.com>

So, I checked - and re-checked the code. Everything is correct. Then, I checked the ColdFusion mail spooler...the text file generated there before the email actually leaves the server is CORRECT.

This leads me to believe that something is happening after the actual data reaches the google servers - somehow the email addresses are getting swapped out.

If it's any help, the mixed up from addresses are always email addresses that were set up a long time ago and then closed/abandoned for other sites I host on the same server.

And, another bit of funkyness to add...

This is happening to the TO addresses in some cases as well. Meaning, emails sent from different sites on the same server (using different Google Apps accounts and credentials) are ending up in the correct inbox AND other, unrelated, sites inboxes as well.

I've determined that the emails are correct as they leave the building on their way to Google (via the ColdFusion mail spooler) - but things seem to go all wonky after that.

Does anyone have any advice on this? The solution I've decided on for now is to move the clients to new mail providers...but this is not an ideal solution because of all the hassle involved in migrating their email over.

aepearson
  • 81
  • 1
  • 5
  • 2
    I am not sure I follow the issue exactly, but I know I have seen issues where, regardless of what I put in the 'from ' attribute, GMail says it is sent from the account that is used to log into the mail server. For example, if I use `moo@gamil.com` to connect to SMTP server via ColdFusion, regardless of what I specify in the 'from' attribute, the email will show that it was sent from 'moo@gmail.com' – Scott Stroz Aug 02 '13 at 21:29
  • Keep in mind, that if you log into a mail server with one set of credentials, and try sending as a different user, it is possible it will get tagged as spam on the recipient's side - as the MX DNS records will not likely match where the mail is actually coming from. – Scott Stroz Aug 02 '13 at 21:36
  • 1
    I thought it had to do with the fact that Google provides this "feature" to it's users as sort of a security thing. It allows the received to know, in fact, where the mail originates from. – Leeish Aug 02 '13 at 22:43
  • I completely get what you guys are saying - the only thing is that I'm sending unique credentials for each email sent. Each client has their own unique account (un/pw)...which, from what I can tell, is being passed in the plain text file that is in the mail spooler. Silly question - but would gmail/google apps keep some sort of "session" if it sees mail coming from the same server? If so, would the "mailerid" attribute for the cfmail tag be relevant at all? – aepearson Aug 05 '13 at 12:51
  • 1
    Have you read this - [Sending mail from a different address](https://support.google.com/mail/answer/22370?hl=en)? – Miguel-F Aug 06 '13 at 14:39
  • **UPDATE** - I have been doing some testing on the site in question. Here's what I've done differently 1. Modified the `` tags to use the "correct" FROM address (the address of the authenticated account) 2. Used a new, fresh, email account for form submissions. This DID NOT WORK...however I think I may have discovered the issue. The TO address is not a valid email address, it's a group that's forwarding to a valid email address (I was not aware of this before). I changed the TO to a valid email in the domain, not in a group, and this seems to have resolved it. **FINGERS CROSSED** – aepearson Aug 06 '13 at 15:01
  • Also, I noticed that the SPF record check is failing after looking at the delivered email header. I will fix this as well. I cannot explain why sending `TO` a gmail/google-apps group address would cause this issue...if this is indeed the fix, it's more blind luck. I don't understand the logic behind why this would be the issue...especially the fact that emails are being delivered to the wrong address in some situations. – aepearson Aug 06 '13 at 15:11

0 Answers0