CodeIgniter Forums

Full Version: Want to use PHPMailer in a Controller in a CI project I will be making?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]bastones[/eluser]
Hi,

I want to use the PHPMailer library (phpmailer.worxware.com) that's quite popular AFAIK, so I'm wondering how would I properly integrate this into my CI-based script so I can use it in the relevant controllers because the PHPMailer library is obviously OOP-based.

Thanks,
Ben.

El Forum

[eluser]mi6crazyheart[/eluser]
why don't you use CI's own Email Class. It's really working cool. Recently i've used it one of my own project & it's working without any pain.....

El Forum

[eluser]bastones[/eluser]
I may end up using CI's built-in Email Class but just wondering for future reference how I would implement separate non-CI OOP-based libraries like PHPMailer into CI?

El Forum

[eluser]pickupman[/eluser]
[quote author="bastones" date="1272754995"]I may end up using CI's built-in Email Class but just wondering for future reference how I would implement separate non-CI OOP-based libraries like PHPMailer into CI?[/quote]
Like you would in PHP. You can include the file, create a new object, and pass methods on the object. If you are wanting to use another PHP class like how they are used in CI, then checkout the user guide for creating your own libraries. The simple explanation is rename class to start with a capital letter and the rest lower case. Place the file in your /application/libraries folder. Then use:
Code:
$this->load->library('phpmailer');
$this->phpmailer->some_method();

El Forum

[eluser]InsiteFX[/eluser]
If you search the forum and wiki you will find that someone
has already created a CI Library for it.

SEARCH - Is your friend...

InsiteFX