when you are creating a website with a user needed to register what do you use to validate users if they are really say they are? yes? any answer? yes. EMAIL.
Email is very essential in validating users.
but how do you send it? you can use PHP Mailer, because it is very useful, you just needed to download an application that sends mail PHP mailer from their website, you just need to copy the folder from a zip file which you needed to download i think it is sized a 2mb size.
include or require the php file. like this:
require '/phpmailer/class.phpmailer.php';
is suggest you use require because it will pop an error if it is not properly included. than include because include bypasses the error if it cant find the file it will still return without an error, but you file will still not be included.
you just needed to declare a php mailer, like this:
$mail = new PHPMailer;
then pass the functions.
like this
$mail->fromName = "sender";
$mail->addAddress= "receiver@domain.com";
$mail->subject= 'this is the subject';
$mail->body='this is the body';
then after y0u pass the parameters, you can send it by:
$mail->send();
put an if to see if it is really sent like
if(!$mail->send()){
echo "failed";
}else{
echo "message successfully sent";
}
or you could use the try clause,
try{
$mail->send();
}catch(exception $e){
echo $e;
}
happy emailing. :)
p.s dont spam please.
Saturday, August 15, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment