Copy link to clipboard
Copied
The smtp username is overiding the from field so every email received will have the smtp username as the sender. What am I doing wrong?
<cfmail
to = "youremail@yahoo.com"
from = "sender123@gmail.com"
subject = "This is a Test"
server = "smtp.gmail.com"
username = "gmailaccount@gmail.com"
password = "passwordhere"
port = "465"
useSSL = "true">
The from address of this email should show "sender123@gmail.com".
However it shows "gmailaccount@gmail.com" which is the smtp username.
Is this is a bug?
</cfmail>
Copy link to clipboard
Copied
Before one cries BUG, one should verify where the change is happening.
I've done tasks nearly exactly like you are trying with local mail systems with no problem.
I would look into the ColdFusion mail logs (you may need to turn on FULL logging in the Administrator).
See what those messages look like.
There is a possibility this is something Google is doing. They may not want people to use different FROM address from the account logged into the gmail server.
Copy link to clipboard
Copied
I did not "cry" bug, I simply asked if this was a bug.
Did you try testing with with gmails smtp server and using a different "from" address then your smtp?
I am able to succesfully use yahoo POP to receive my mail and gmail's SMTP to send my mail using thunderbird, however CFMail is just overiding the from field with the smtp username.
Copy link to clipboard
Copied
I have no problem using setting the from address using a private smtp server, so I think the chance of it being a bug super small.
I think you will find gmails smtp servers will not allow you to changes the senders email address. Otherwise it would be abused by spammers alot.
You mentioned being able to send email using thunderbird, can you successfully override the sender address that way?
Cheers
Copy link to clipboard
Copied
LionelR wrote:
CFMail is just overiding the from field with the smtp username.
My point is that I really, Really, REALLY doubt that <cfmail...> is doing this.
I strongly suspect it is Google's Gmail servers that are overriding the from field with the smtp username.
Copy link to clipboard
Copied
I'm with Ian.
It's easy to test, too.
* block the connection to the SMTP server temporarily;
* send an email as per usual;
* check the email that was sent in the undelivr directory;
I would bet that the "server-username", "from" and "to" values are correct. And that's what CF is sending to the SMTP server.
--
Adam
Copy link to clipboard
Copied
Google do this as part of their anti spam - if the from address is not
the same as the login account it overrides it.
You should never send an email for one domain from a server not in the
trusted list for that, as that increases your spam rating.
If your site is going to send an email to someone else, it should have
the from address as your domain, but the reply to as the person sending
it, as a way round this,
HTH