HomeWeb HostingReseller Web HostingDedicated ServerResources & Support

Go Back   Web Hosting Technical Support Discussion Forum > General Web Hosting Discussion Forum and Support > How To's > PHP Scripts

PHP Scripts Post Only PHP Scripts in this section... Accu Web Hosting
Become a Fan


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 08-20-2008
Administrator
 
Join Date: Jun 2006
Age: 26
Posts: 266
Blog Entries: 9
Rep Power: 10
Shane has disabled reputation
Default How to send email via PHPMailer – Linux server

Hello All,

In order to send email from Linux server from PHPMailer then one can use below mentioned sample script:


<?php
require("class.phpmailer.php");
$mail = new PHPMailer();

$mail->IsSMTP(); // send via SMTP
$mail->Host = "mail.yourdomainname"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "SMTP Email Username"; // SMTP username
$mail->Password = "SMTP Email password"; // SMTP password

$mail->From = "From Email address";
$mail->FromName = "Name to Display";
$mail->AddAddress("Recipient Email address ","Recipient Name");
$mail->AddCC(“CC Email Address”);
$mail->AddBCC(“BCC Email address”);
$mail->AddReplyTo("Reply to email address");

$mail->WordWrap = 50; // set word wrap

$mail->IsHTML(true); // send as HTML

$mail->Subject = "Subject";
$mail->Body = "body";

if(!$mail->Send())
{
echo "Message did not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}

echo "Message has been sent";
?>

Thanks,

Shane G.
AccuWebHosting.Com

Last edited by Shane; 03-28-2009 at 02:26 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-26-2008
Member
 
Join Date: Jun 2008
Age: 21
Posts: 97
Blog Entries: 29
Rep Power: 21
ryan is on a distinguished road
Default Re: How to send email via PHPMailer – Linux server

Hello Shane,

Hey, that was really a great script.. I was searching for a long while. Thank you very much man.. But one thing, when I add the CC and BCC fields, it gives me the error. Hence I need to remove those fields. can you help it out?????
__________________
Best regards,

Ryan S.

Best Wordpress Themes
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 10:18 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
http://www.accuwebhosting.com/terms.htm


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42