Skip to main content

Posts

Send Mail Using PhpMailer

Hello,     Right not it is common for sending mail for every site for subscription, registration etc. Here I have explain you how to send mail using Phpmailer. It is very easy you nee to only two file 1 ) class.smtp.php 2) class.phpmailer.php From the below given link you can download above two files Download phpmailer library After downloading this two files make one new file "phpmailer.php" and put below code. Using only two files your work done. Here i write one function for sending mail using it you can send mail. <?php function sendEmailAddress($to, $subject, $message) { require_once("class.phpmailer.php"); $mail = new PHPMailer(); // create a new object $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = 'tls'; $mail->Host = "SMTP HOST NAME"; $mail->Port = 587; // o
Recent posts

Add Google Translator to your website

GoogleTransalator Add Google Transalator to your website or webpage Step 1 Go to  https://translate.google.com/manager/website/  and sign in to your Google account when you are prompted to. Step 2 Enter Your website url or your can also enter your localpath url and choose Language. Step 3 Click on Next Button and Select Language that you want to display on your Website or webpages. Here you can also select specific language. Step 4 Select your display mode. Step 5 Get code. This code your have to enter into your page. <div id="google_translate_element"></div><script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element'); } </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslat

Write a PHP script to count lines in a file.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Count File</title> </head> <body> <p>Count File</p> <p>Count File</p> <p>Count File</p> <p>Count File</p> </body> </html> <?php $file =basename($_SERVER['PHP_SELF']); $no_of_lines =count(file($file)); echo $no_of_lines; ?> Output:
Write a PHP script to print current PHP version <?php echo 'Current PHP version : ' . phpversion(); ?>  Write a PHP script to redirect a user to a different page . <?php header('Location:http://www.google.com'); ?> Write a PHP script to get last modified information of a file. <?php $file_last_modified = filemtime(basename($_SERVER['PHP_SELF']));    echo "Last modified " . date("l, dS F, Y, h:ia", $file_last_modified);   ?>

Write a PHP script, which change the color of first character of a word.

Write a PHP script, which change the color of first character of a word. <?php   $text = 'PHP Tutorial';   $text = preg_replace('/(\b[a-z])/i','<span style="color:red;">\1</span>',$text);   echo $text;   ?>  

Write a PHP script, which will return the following components of the url 'http://localhost/ex/php/8.php'.

Write a PHP script, which will return the following components of the url 'http://localhost/ex/php/8.php'. <?php $url1 ='http://www.w3resource.com/php-exercises/php-basic-exercises.php';   $url = 'http://localhost/ex/php/8.php';   $url=parse_url($url);   echo "<pre>"; print_r($url); echo 'Scheme : '.$url['scheme'].'<br />';   echo 'Host : '.$url['host'].'<br />';   echo 'Path : '.$url['path'].'<br />';   ?>