4
Contributors
6
Replies
18
Views
3 Years
Discussion Span
Last Post by suresh.chaudhari.75
0

Your SMTP login information is incorrect judging by the error alone.
Check your username and password is right.

0

Did you turn on Forwarding POP/IMAP function in your gmail account ?

0
<?php
//I am using it on gmail with mail.smtp.com
//session_start();
require("PHPMailer_5.2.4/class.phpmailer.php");

$fn = $_POST['name1'];
$ln = $_POST['address'];
$company = $_POST['email'];
$em = $_POST['comments'];
/*$mob = $_POST['mobile_no'];
$ca = $_POST['challenge_area'];
$ar = $_POST['area'];
$ct= $_POST['city'];*/

// $email and $message are the data that is being
// posted to this page from our html contact form
//$email = $_REQUEST['email'] ;


// When we unzipped PHPMailer, it unzipped to
// public_html/PHPMailer_5.2.0


$mail = new PHPMailer();

$mail->IsSMTP();  // telling the class to use SMTP
$mail->SMTPAuth   = true; // SMTP authentication
$mail->Host       = "mail.urwebsite.com"; // SMTP server
$mail->Port       = 587; // SMTP Port
$mail->Username   = "query@urwebsite.com"; // SMTP account username
$mail->Password   = "query123";        // SMTP account password

$mail->SetFrom('query@urwebsite.com','website'); // FROM
$mail->AddReplyTo('query@urwebsite.com', 'website'); // Reply TO

$mail->AddAddress('query@urwebsite.com', 'website'); // recipient email

$mail->Subject    = "You have received feedback from your website!"; // email subject
$mail->Body    = $fn . " has contacted query@squirrels.co.in at Squirrels.\nFirst Name : " .$fn . "\nLast name: " .$ln . "\nCompany: " .$company . "\nEmail: " .$em; //. "\nMobile: " .$mob . "\nCity: " .$ct . "\nChallenge Area: " .$ca . "\nArea: " .$ar;

if(!$mail->Send()) 
    {
             echo 'Message was not sent.';
         echo 'Mailer error: ' . $mail->ErrorInfo;
    } 
    else {
            echo"<script>alert('Thanks For Your Interest')</script>";

Edited by pritaeas: Fixed markdown.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.