SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output $mail->isSMTP(); // Send using SMTP $mail->Host = 'singhkranjeet123@gmail.com'; // Set the SMTP server to send through $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'singhkranjeet123@gmail.com'; // SMTP username $mail->Password = 'singh$321'; // SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom('singhkranjeet123@gmail.com', 'Company'); //Sender E-mail $mail->addAddress('ak1873821@gmail.com'); // Add a recipient // $mail->addReplyTo('info@example.com', 'Information'); // $mail->addCC('cc@example.com'); // $mail->addBCC('bcc@example.com'); // Content $mail->isHTML(true); //For sending HTML content $mail->Subject = 'Form Submission'; //E-Mail Subject $mail->Body = 'Name : '.$name.'
Phone : '.$phone.'
Email : '.$email.'
Has written you : '.$message; //E-Mail body $mail->send(); $result = ''; } catch (Exception $e) { $result = ''; } } ?> Contact Form Using PHPMailer Library

Contact Us Form!