on our new server we was getting problem with mail sending. yahoo and some other mail server was not receiving our mails to there inbox. so i imported the most popular php class (phpmailer ) in codeigniter as plugin. it’s install and use is too simple. you have to download the zip file from here, then unzip it to your plugin (system\plugins) folder. then edit phpmailer_pi.php , and edit the default configuration as needed as your mail server (default configuration will work fine with gmail smtp, you only have to edit the user name and pass) .
download:
usage:
you can now use all the functions that phpmailer supported. here is a the example that you will get in phpmailer site, but in ci format.
< ?php /* * Created on May 19, 2008 * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ class Action extends Controller { function Action() { parent::Controller(); } function testMailer() { error_reporting(E_ERROR); $this->load->plugin('phpmailer'); $mail=new PHPMailer(); /*$mail->IsSMTP(); $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port $mail->Username = "username@somedomain.com"; // GMAIL username $mail->Password = "xxxxxx"; // GMAIL password */ $mail->From = "username@somedomain.com"; $mail->FromName = "sender name"; $mail->Subject = "This is the subject"; $mail->Body = "Hi,This is the HTML BODY"; //HTML Body $mail->AltBody = "This is the body when user views in plain text format"; //Text Body //print_r($mail); $mail->WordWrap = 50; // set word wrap $mail->AddAddress("someone@somedomain.com"); $mail->AddReplyTo("username@somedomain.com","sender name"); $mail->AddAttachment("/path/to/file.zip"); // attachment $mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment $mail->IsHTML(true); // send as HTML if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; } } } ?> |
imagemagick is one of the best library to work with image. recently i have to install it to our production server. here is what i did:
$ apt-get install imagemagick
it downloads the package and all it’s dependences from debian/ubuntu repository, and installed. now i have to install the support of php (as our product running on php)
$ apt-get install php5-imagick
then i restarted the apache server to take effect this new package installation. if your using php4 then the package name should be php4-imagick
$ /etc/init.d/apache2 restart
that’s all
if you need imagemagick for your ruby , you can install the librmagick-ruby package.
Sphere: Related ContentHere i am going to describe how to enable mod_rewrite in apache2.2 -specaily for debian.
In default installion of apache2.2 on debian never enable mod_rewrite default. So you may need to enable .
First install the apache2.2 with this command :
debian user please use “su” before start this process
ubuntu user please use “sudo su” before start this process
apt-get install apache2 (it will install apache 2.2)
now use locate to find if the mod_rewrite.so is availble on your server
updatedb
locate mod_rewrite.so
it will found in “/usr/lib/apache2/modules”
new apache follow some folders to enable and desuable mods.
so now do this:
cd /etc/apache2/mods-enabled
touch rewrite.load
gedit rewrite.load (you may use any editor to edit this file)
now paste this following line
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
Then edit /etc/apache2/sites-available/000-default
Find the following
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
and change it to
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
and finally restart Apache
/etc/init.d/apache2 restart
OK, you done
don’t forget to comment, if it works or not.
thanks.
Sphere: Related Content