CodeIgniter Forums
Email Class - User-Agent Header - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Email Class - User-Agent Header (/showthread.php?tid=34557)



Email Class - User-Agent Header - El Forum - 10-03-2010

[eluser]Unknown[/eluser]
I'm trying to change the User-Agent and X-Mailer headers sent out by CodeIgniter's email class, so that there's no way that anyone can find out that the website is running on the CI framework.

As per the manual, I've made an application/config/email.php file containing the following:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$config['mailtype'] = 'html';
$config['useragent'] = 'MyUseragentHere';

When I look at the headers in the incoming emails, they look like this:

Code:
User-Agent: CodeIgniter
X-Mailer: MyUseragentHere

Note that one of the headers has been changed by CI but the other hasn't?!

Please note that calling $this->email->clear() after loading the email library fixed the problem. This isn't desirable though, as I don't want to have to call this every time I want to load the library send an email!

Any suggestions on how to fix without editing the CI system files (want to keep things nice and clean in case of future upgrades etc.) much appreciated.


Email Class - User-Agent Header - El Forum - 10-03-2010

[eluser]InsiteFX[/eluser]
Maybe extend the email class!

InsiteFX


Email Class - User-Agent Header - El Forum - 10-03-2010

[eluser]Unknown[/eluser]
[quote author="InsiteFX" date="1286127337"]Maybe extend the email class!

InsiteFX[/quote]

Sorry, could you explain exactly what you mean please?
I'm no PHP rookie but this is my first ever time playing with CI!


Email Class - User-Agent Header - El Forum - 10-03-2010

[eluser]InsiteFX[/eluser]
Extend Core Classes

InsiteFX