Codeigniter email always sends from 'my@gmail.com' instead of the input email given Codeigniter email always sends from 'my@gmail.com' instead of the input email given codeigniter codeigniter

Codeigniter email always sends from 'my@gmail.com' instead of the input email given


My guess is that Gmail restricts any arbitrary "from" address.Why ? To prevent spoofing.

(Imagine if it were possible, you could send anyone an email from "big_bank@blabla.com"...)

EDIT : A quick google search yielded this : How to change from-address when using gmail smtp server

Google rewrites the From and Reply-To headers in messages you send via it's SMTP service to values which relate to your gmail account.

The SMTP feature of gmail isn't intended to be an open or relay service. If it allowed any values for the From header, it would significantly dilute Google's standing with spam services, as there would be no way to verify the credentials of the sender.

Source : https://stackoverflow.com/a/1332803/2615399

Tl;dr : you can't (...using gmail).