Sending multiple data with SMTP - php

Here is index.html codes;
<form name="contactform" method="POST" action="send.php">
Name: <input type="text" name="ad_soyad" size="25"><br />
Telephone: <input type="text" name="tel" size="25"><br />
E-Mail: <input type="text" name="email" size="25"><br />
Address: <textarea rows="5" name="adres" cols="25"></textarea><br />
Message: <textarea rows="5" name="mesaj" cols="25"></textarea><br />
<input type="submit" name="button" value="Gonder">
</form>
Here is send.php codes:
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'blablabla.com';
$mail->SMTPAuth = true;
$mail->Username = 'blablabla.com';
$mail->Password = 'password';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
if(($ad_soyad=="") or ($tel =="") or ($email=="") or ($mesaj=="")){
echo "<center>Please fill the required fields.<br><a href=index.html>Go back</a></center>";
}
else
{
$mail->setFrom($_POST['email']);
$mail->addAddress('contact#blablabla.com', 'BlaBlaBla');
$mail->isHTML(true);
$mail->Subject='Contact Form Message';
$mail->Body = ($_POST['mesaj']);
$smtp = new SMTP;
//Enable connection-level debug output
$smtp->do_debug = SMTP::DEBUG_CONNECTION;
if(!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent.';
}
}
?>
It works.
But only sends name,email and message.
So, I want to add more field like telephone or address or etc.
but i can not put them into $mail->body when i tried to write telephone and message together
it gives me error:"not configured properly "
I have to use SMTP because my hosting only provides SMTP..
how can i send all datas which form gets from user ,with SMTP?

I don't know if this will solve the issue - I can't understand why it should fail if you add more content to the message body but as you have not shown that I can only guess it was done in such a way as to make invalid markup?
<?php
/* Are these variables defined before this point? */
if( ( $ad_soyad=="" ) or ( $tel =="" ) or ( $email=="" ) or ( $mesaj=="" ) ){
echo "<center>Please fill the required fields.<br><a href=index.html>Go back</a></center>";
} else {
/* only load the libraries if the above variables are not empty */
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'blablabla.com';
$mail->SMTPAuth = true;
$mail->Username = 'blablabla.com';
$mail->Password = 'password';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
/* some basic filtering of user supplied variables */
$email=filter_input( INPUT_POST, 'email', FILTER_VALIDATE_EMAIL );
$message=filter_input( INPUT_POST, 'mesaj', FILTER_SANITIZE_STRING );
$name=filter_input( INPUT_POST, 'ad_soyad', FILTER_SANITIZE_STRING );
$tel=filter_input( INPUT_POST, 'tel', FILTER_SANITIZE_STRING );
$address=filter_input( INPUT_POST, 'adres', FILTER_SANITIZE_STRING );
/* prepare message components */
$msg=array();
$msg[]="Name:".$name;
$msg[]="Phone:".$tel;
$msg[]="Address:".$address;
$msg[]="Message:".$message;
$mail->setFrom( $email );
$mail->addAddress('contact#blablabla.com', 'BlaBlaBla');
$mail->isHTML(true);
$mail->Subject='Contact Form Message';
$mail->Body = implode( "\r\n", $msg );
$smtp = new SMTP;
//Enable connection-level debug output
$smtp->do_debug = SMTP::DEBUG_CONNECTION;
if( !$mail->send() ) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent.';
}
$mail = $smtp = null;
}
?>

Related

How would I get the phone number and name displayed on emails I recieve - PHPMailer

So the emails I recieve only shows the subject, who it was sent from, who it was sent to but not the senders name or phone number, this is not done locally but from where my website is hosted. I want it to show the senders name and phone number after the body. This is my code:
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
require 'vendor/autoload.php';
$mail = new PHPmailer();
$mail->Host = "";
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->SMTPDebug = SMTP::DEBUG_OFF;
$mail->Username = "";
$mail->Password = "";
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->addAddress('');
$mail->setFrom($_POST['email']);
$mail->Subject = $_POST['subject'];
$mail->isHTML(true);
$mail->Body = $_POST['message'];
$mail->Name = $_POST['name'];
$mail->Phone = $_POST['number'];
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
//echo $mail->ErrorInfo;
?>
This is my html:
<form action="contact.php" method="post" class="signin-form mt-lg-5 mt-4">
<div class="input-grids">
<input type="text" name="name" placeholder="Full name or Business"
class="contact-input" required=""/>
<input type="email" name="email" placeholder="Your email" class="contact-
input" required=""/>
<input type="text" name="subject" placeholder="Subject" class="contact-
input" required=""/>
<input type="text" name="number" placeholder="Phone number"
class="contact-input" />
</div>
<div class="form-input">
<textarea name="message" placeholder="Type your message here"
required=""></textarea>
</div>
<div class="form-input mb-5">
<label class="container"><p>Send me a copy <a href="#">privacy policy.
</a></p>
<input type="checkbox">
<span class="checkmark"></span>
</label>
</div>
<button class="btn submit">Submit</button>
</form>
I am not sure if I need to do something like this:
if (isset($_POST['submit'])) {
require 'vendor/autoload.php';
$mail = new PHPmailer();
$mail->Host = "";
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->SMTPDebug = SMTP::DEBUG_OFF;
$mail->Username = "";
$mail->Password = "";
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->addAddress('');
$mail->setFrom($_POST['email']);
$mail->Subject = $_POST['subject'];
$mail->isHTML(true);
$mail->Body = $body . "<br>Phone number: " . $number . "<br>Name: " . $name;
}
$body = $_POST['message'];
$name = $_POST['name'];
$phone = $_POST['number'];
and just give my submit button this attribute
<button class="btn submit" name="submit">Submit</button>
Last thing: I want to show that the message has been sent just above the contact form instead of at the top of the page, it is not top priority but something I was still wondering about.
You basically want to create a $message variable and assign that to $mail->Body.
The second example you have shown is close but you need to make sure that the below is within your $_POST['submit'] if statement.
$body = $_POST['message'];
$name = $_POST['name'];
$phone = $_POST['number'];
Like so:
if (isset($_POST['submit'])) {
require 'vendor/autoload.php';
$body = $_POST['message'];
$name = $_POST['name'];
$phone = $_POST['number'];
$mail = new PHPmailer();
$mail->Host = "";
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->SMTPDebug = SMTP::DEBUG_OFF;
$mail->Username = "";
$mail->Password = "";
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->addAddress('');
$mail->setFrom($_POST['email']);
$mail->Subject = $_POST['subject'];
$mail->isHTML(true);
$mail->Body = $body . "<br>Phone number: " . $number . "<br>Name: " . $name;
$response = $mail->send(); //to actually send the email
}
For:
Last thing: I want to show that the message has been sent just above the contact form instead of at the top of the page, it is not top priority but something I was still wondering about.
You could subject the form via ajax and listen to the $response value. If its 1 then good to go, else there was an issue.

PHP mailer can not send e-mail via SMTP

I made a PHP mailer but it's not working anymore. It used to work but i changed nothing. It doesnt send the email. I filled in all the neccesary information for it to work but it doesnt. I know im not quite clear with my problem that because i dont know what the problem is and im not really good if it comes to PHP.
Here's the code.
This is the INDEX.PHP
<?php
session_start();
require_once 'helpers/security.php';
$errors = isset($_SESSION['errors']) ? $_SESSION['errors'] : [];
$fields = isset($_SESSION['fields']) ? $_SESSION['fields'] : [];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contact form</title>
<link rel="stylesheet" href="css/style.css"/>
<script src="js/test.js"></script>
</head>
<body>
<div class="contact">
<?php if(!empty($errors)): ?>
<div class="panel">
<ul>
<li>
<?php echo implode('</li><li>', $errors); ?>
</li>
</ul>
</div>
<?php endif; ?>
<form action="contact.php" method="post">
<label>
Your name*
<input type="text" name="name" autocomplete="off" <?php echo isset($fields['name']) ? 'Value="' . e($fields['name']) . '"' : '' ?>>
</label>
<label>
Your email address *
<input type="email" name="email" autocomplete="off" <?php echo isset($fields['email']) ? 'Value="' . e($fields['email']) . '"' : '' ?>>
</label>
<label>
Your message *
<textarea name="message" rows="8"><?php echo isset($fields['message']) ? e($fields['message']) : '' ?></textarea>
</label>
<input type="submit" value="Send">
<p class="muted">* Means a required field</p>
</form>
</div>
</body>
</html>
<?php
unset($_SESSION['errors']);
unset($_SESSION['fields']);
?>
This is the CONTACT.PHP
<?php
session_start();
require_once "libs/phpmailer/PHPMailerAutoload.php";
$errors = [];
if(isset($_POST['name'], $_POST['email'], $_POST['message'])) {
$fields = [
'name' => $_POST['name'],
'email' => $_POST['email'],
"message" => $_POST['message']
];
foreach($fields as $field => $data) {
if(empty($data)){
$errors[] = 'The ' . $field . ' field is required.';
}
}
// 587 is voor uitgaande email deze is SSL en SMTP.ziggo.nl
// 993 is voor inkomende email deze is TLS en IMAP.ziggo.nl
// 110 is voor inkomende email deze is POP3 en
if(empty($errors)){
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Host = 'smtp1.example.com';
$mail->Username = 'example';
$mail->Password = 'secret';
$mail->SMTPSecure = 'tls';
$mail->Port = 69;
$mail->isHTML();
$mail->Subject = 'Contact form submitted';
$mail->Body = 'From: ' . $fields['name'] . ' ('. $fields['email'] .') <p>'. $fields['message'] .'</p>';
$mail->FromName = 'Contact';
$mail->AddAddress('email', 'name');
if($mail->send()){
header('Location: bedankt.php');
die();
} else {
$errors[] = 'Sorry we konden de email niet verzenden, Probeer later nog een keer.';
}
}
} else {
$errors[] = 'Something went wrong.';
}
$_SESSION['errors'] = $errors;
$_SESSION['fields'] = $fields;
header('location: index.php');
I hope you guys can help me with the information i've given here.
If something is missing please say so
UPDATE
The problem has been solved. I had nothing to do with the code but it was an isseu with the host, Thanks for the help!
First: In contact.php are you sure about port 69 and why not 587 ?
if you are using ziggo the $mail->Host must be smtp.ziggo.nl
Uitgaande serverinstellingen
server: smtp.ziggo.nl
serverpoort: 587
Use ssl: type versleuteling: STARTTLS, TLS of SSL
Be carefull with $mail->isSMTP(); that it is true $mail->isSMTP(true);
working example:
<?php
$path = $_SERVER['DOCUMENT_ROOT'];
require $path.'/phpmailer/PHPMailerAutoload.php'; //the downloaded zip with PHPMailerAutoload i have put into a directoru called phpmailer!!
//require 'PHPmailer.php';
$_error = '';
// insert configs
$_smtpAuth = 'true'; //true
$_smtpSecure = 'SSL'; // TLS og SSL
$_smtpHost = 'send.one.com'; //one.com has send.one.com //gmail has smtp.gmail.com
$_smtpPort = '465';
$_smtpUsername = 'xxx#qwerty.com'; //your email address or username
$_smtpPassword = 'xxxXxxxy'; //your password
$mail = new PHPmailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(true); // Set mailer to use SMTP
$mail->Host = $_smtpHost;//$_smtpHost.';smtp2.example.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = $_smtpAuth; // Enable SMTP authentication
$mail->Username = $_smtpUsername; // SMTP username
$mail->Password = $_smtpPassword; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = $_smtpPort; // TCP port to connect to
$mail->setFrom('name#yourwebmail.com', 'Mailer');
$mail->addAddress('', ''); // Add a recipient
$mail->addAddress(''); // Name is optional
$mail->addReplyTo('', ''); //$mail->addReplyTo('info#example.com', 'Information');
$mail->addCC('name#awebmail.com'); //Recipient The sender of the email
$mail->addBCC('');
$mail->addAttachment(''); // Add attachments
$mail->addAttachment(''); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>
date_default_timezone_set('Europe/Berlin');
require("class.phpmailer.php");
$mail = new phpmailer();
$mail->IsSMTP(); // per SMTP verschicken
$mail->Host = "example.com"; // SMTP-Server
$mail->SMTPAuth = true; // SMTP mit Authentifizierung benutzen
$mail->Username = "example"; // SMTP-Benutzername
$mail->Password = "example"; // SMTP-Passwort
$mail->From = "test#example.com";//any address
$mail->FromName = "example";
$mail->AddAddress($to,"");
$mail->IsHTML(true); // als HTML-E-Mail senden
$mail->Subject = "Confirmation mail ";
$mail->Body = "<html><body>Dear example <br/><br/><br/> \nKind regards\n<br/><br/> KM </body></html>";
if(!$mail->Send())
{
echo "error";
}
else
{
echo "send";
}

Php script to sending email doesn't work

I created a simple form on my page and now I tried to add php script to sending email. Unfortunately it does not work. After clicking on the button, I want the user to remain on my side without redirection.
mail_sender.php
<?php
if(isset($_POST['submit'])){
$to = "someone#gmail.com";
$from = $_POST['email'];
$message = " You received the fallowing message:" . "\n\n" . $_POST['message'];
mail($to,$message,$from);
echo "Mail Sent. Thank you, we will contact you shortly.";
}
?>
HTML
<form action="mail_sender.php" method="post">
<textarea id="email" name="email" rows="1" cols="30" placeholder="Type your email"></textarea>
<textarea id="formContent" name="message" rows="6" cols="30" placeholder="Type your message"></textarea>
<input type="submit" id="submit" value="Send">
</form>
First of all name attribute is missing in your submit button. And php mail function is wrong.
It should be:
$subject = "Your subject";
$headers = "From: $from ";
mail($to,$subject,$message,$headers);
instead of:
mail($to,$message,$from);
PHP's default mail() function doesn't work most of the times, especially with GMail. This is because your e-mail needs to be formatted in a special way to be accpeted by Google's mail server. You'll be better off using a mail library like PHPMailer.
Here's how to send an e-mail using PHPMailer from a GMail Account.
$mail = new PHPMailer();
// ---------- adjust these lines ---------------------------------------
$mail->Username = "xxx#gmail.com"; // your GMail user name
$mail->Password = "passwd"; // your GMail Password
$mail->AddAddress("yyy#gmail.com"); // recipients email
$mail->FromName = "Your Name"; // readable name
$mail->Subject = "Subject";
$mail->Body = "Body";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsSMTP(); // use SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->From = $mail->Username;
//----------------------------------------------------------------------
if(!$mail->Send())
{
echo "mail sent";
}
I tried everything and now i received message SMTP ERROR: Failed to connect to server and SMTP connect() failed
<form action="mail_sender.php" method="post">
<textarea id="email" name="email" rows="1" cols="30" placeholder="Type your email"></textarea>
<textarea id="formContent" name="message" rows="6" cols="30" placeholder="Type your message"></textarea>
<input type="submit" name="submit" id="submit" value="Send">
</form>
PHP
<?php
require "PHPMailer-master/PHPMailerAutoload.php";
$mail = new PHPMailer();
$to = "someone#gmail.com"; // required
$from = $_POST['email'];
$comment =
'Email: '.$from.' <br> />
Message: '.$_POST['message'].' <br> />'
;
$mail->Username = "someone#gmail.com"; // your GMail user name
$mail->Password = "Password"; // your GMail Password
$mail->AddAddress("someone#gmail.com"); // recipients email
$mail->setFrom($_POST['email']);
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->SMTPDebug = 1;
$mail->IsSMTP(); // use SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Subject = 'Here is the subject';
//----------------------------------------------------------------------
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>

php mailer is not working

Here's my phpmailer code, its not working , dont know where i am getting error.
I have to embed this code in certain script and i think for gmail port no port no 465 .
<?php
if(isset($_POST['submit'])) {
require_once('phpmailer/class.phpmailer.php');
$email=$_POST['email'];
$subject1=$_POST['subject'];
$message=$_POST['message'];
smtpmailer($email,$subject1,$message);
function smtpmailer($to,$subject,$body) {
global $error;
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "aman****589#gmail.com";
$mail->Password = "*****02589";
$mail->From = "aman***589#gmail.com";
$mail->FromName = "Cor****tions";
$mail->Subject = $subject;
$mail->Body = $body;
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
}
}
?><html><body>
<form method="post" action="index.php">
Email: <input name="email" id="email" type="text" /><br />
Subject:<br />
<textarea name="subject" id="subject" rows="2" cols="40"></textarea><br />
Message:<br/>
<textarea name="message" id="message" rows="15" cols="40"></textarea><br />
<input type="submit" value="Submit" name="submit"/>
</form>
</body>
</html>
Can anybody help ?? where i m getting error?
when i run this script its giving error-
Fatal error: Call to undefined function smtpmailer() in C:\xampp\htdocs\phpm\index.php on line 8
You have to declare a function with its parameters, before you call it. At the moment, your program is searching for the function smtpmailer() - but it is not even defined yet.
<?php
if(isset($_POST['submit'])) {
require_once('phpmailer/class.phpmailer.php');
$email=$_POST['email'];
$subject1=$_POST['subject'];
$message=$_POST['message'];
function smtpmailer($to,$subject,$body) {
global $error;
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "aman****589#gmail.com";
$mail->Password = "*****02589";
$mail->From = "aman***589#gmail.com";
$mail->FromName = "Cor****tions";
$mail->Subject = $subject;
$mail->Body = $body;
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
}
smtpmailer($email,$subject1,$message);
}
?><html><body>
<form method="post" action="index.php">
Email: <input name="email" id="email" type="text" /><br />
Subject:<br />
<textarea name="subject" id="subject" rows="2" cols="40"></textarea><br />
Message:<br/>
<textarea name="message" id="message" rows="15" cols="40"></textarea><br />
<input type="submit" value="Submit" name="submit"/>
</form>
</body>
</html>
Declare the function before you call it.

phpmailer secure approach by placing credentials out of the web root in INI file

first of all thank you for your time and helping me on this.
I have a simple contact form and i'm using phpmailer.
I want to store credentials in an INI file out of webroot and then include it in my mail.php file which is the mail sending script.
How to write the INI content and how to call them on mail.php file?
This is my HTML file which is contact us form:
<h3><font style="line-height:170%" size="4"> <a id="contactus">Contact us form</a> </font></h3>
<form method="post" action="email.php" accept-charset="UTF-8">
<p>
<label>your name</label>
<input name="dname" type="text" size="30" />
<label>your email</label>
<input name="demail" type="text" size="30" />
<label>your domain name</label>
<input name="ddomain" type="text" size="30" />
<label>Message</label>
<textarea name="dmessage" id="dmessage" rows="5" cols="5"></textarea>
<br />
<input class="button" type="submit" value="submit"/>
</p>
</form>
<br />
and this is the email.php file:
<?php
header('Content-type: text/plain; charset=utf-8');
$email = $_REQUEST['demail'] ;
$message = $_REQUEST['dmessage'] ;
$ddomain = $_REQUEST['ddomain'] ;
require("PHPMailer_v5.1/class.phpmailer.php");
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsSMTP();
$mail->Host = "localhost";
$mail->SMTPAuth = true;
$mail->Username = "info#example.com"; // SMTP username
$mail->Password = "this is the password"; // SMTP password
$mail->From = $email;
$mail->AddAddress("info#example.com");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $ddomain;
$mail->Body = $message;
$mail->AltBody = $ddomain;
if(!$mail->Send())
{
echo "Error <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "we have received your email";
?>
I want to store credentials in a safe place.
Another problem is that whenever someone open email.php file in browser ( example.com/email.php) an empty email will be sent to me, how to prevent it?
I want the email.php file to be executed only a result of a customer's contact via filling the form and not by directly opening the email.php file
Thank you all
<?php
if (empty($_REQUEST['demail']) || empty($_REQUEST['dmessage'])) {
die();
}
$constants = parse_ini_file("/outside/web/sample.ini");
header('Content-type: text/plain; charset=utf-8');
$email = $_REQUEST['demail'] ;
$message = $_REQUEST['dmessage'] ;
$ddomain = $_REQUEST['ddomain'] ;
require("PHPMailer_v5.1/class.phpmailer.php");
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsSMTP();
$mail->Host = "localhost";
$mail->SMTPAuth = true;
$mail->Username = $constants['username']; // SMTP username
$mail->Password = $constants['password']; // SMTP password
$mail->From = $email;
$mail->AddAddress("info#example.com");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $ddomain;
$mail->Body = $message;
$mail->AltBody = $ddomain;
if(!$mail->Send())
{
echo "Error <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "we have received your email";
?>
INI file (sample.ini) looks like:
username = "info#example.com"
password = "PASSW0RD"
Thank you for your helps.
I did some change on your code and it is excatly what is want.
instead of saying:
if (empty($_REQUEST['demail']) || empty($_REQUEST['dmessage'])) {
die();
}
i used this one:
if (empty($_REQUEST['demail']) || empty($_REQUEST['dmessage'])) {
echo "Please fill-in Email and Message sections completely!";
exit;
}
Thank you for your help

Categories