Frequently Asked Question

FAQ / Linux Shared Hosting


How to use PHP mail using SMTP authentication code?

Step 1 : Download the php mailer zip file using the link.

Step 2 : Once downloaded, unzip and extract the files to public_html folder. Now you will have the path as

public_html/PHPMailer

Step 3 : After extracting the files, change the webpage using the below given code.

HTML Code



Email: < input name=email id=email type=text / >
Message :
< textarea name=message id=message rows=15 cols=40 >


PHP Code


< ? php
// $email and $message are the data that is being
//posted to this page from our html contact form

$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
require(/home/username/public_html/PHPMailer/class.phpmailer.php);
$mail = new PHPMailer();$mail->IsSMTP();
$mail->Host = yourdomain.com;
$mail->SMTPAuth = true;

$mail->Username = sending@yourdomain.com; // SMTP username
$mail->Password = I{i&cWv(o1nh; // SMTP password

$mail->From = $email;
$mail->AddAddress(recieving@yourdomainname.com, testing);
$mail->WordWrap = 50;
$mail->IsHTML(true);

$mail->Subject = You have received feedback from your website!;
$mail->Body = $message;
$mail->AltBody = $message;

if(!$mail->Send())
echo "Message could not be sent.";
else
echo "Message sent";
?>

How this faq is helpful:

Not at all
helpful
Not much
helpful
Some what
helpful
Very
helpful
Extremely
helpful

What could be better? (Optional)
X
  Not related to my issue
  Too complicated explanations
  Too much information
  Incorrect information
  Unclear information
  Incomplete information
  Too old information
Do you have any other feedback about this faq ?
1000