SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output $mail->isSMTP(); //Send using SMTP $mail->Host = 'ssl://smtp.gmail.com'; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = 'rahulkatari99@gmail.com'; //SMTP username $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption // $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail $mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom('rahulkatari99@gmail.com', 'rahul Sales'); $mail->addAddress('rahulkatari99@gmail.com', 'rahul'); //Add a recipient //$mail->addAddress('ellen@example.com'); //Name is optional $mail->addReplyTo('rahulkatari99@gmail.com', 'reply-to-rahul'); //$mail->addCC('cc@example.com'); //$mail->addBCC('bcc@example.com'); //Attachments // $mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name //Send HTML or Plain Text email $mail->isHTML(true); if(!empty($_POST['email'])){ $companyName=$_POST['companyName']; $contactName=$_POST['contactName']; $email=$_POST['email']; $phone=$_POST['phone']; $subject=$_POST['subject']; $message=$_POST['message']; } $body = "
Company Name | $companyName |
Contact Person | $contactName |
Phone | $phone |
Subject | $subject |
Message | $message |