I am responsible for a job application form that does not seem to be working well. The problem is that emails from this form are not always receiving. The weird fact is that I also configured a CC email address in this script (another server) and that email address is always receiving mail in that inbox. Personally I think this is a server problem but maybe I am missing something.
UPDATE: Another website is running on that same server with a contact form that appears to be working fine.
See my code below.
Any help would be greatly appreciated.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>title</title>
<meta name="description" content="" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.9/css/all.css" integrity="sha384-5SOiIsAziJl6AWe0HWRKTXlfcSHKmYV4RBF18PPJ173Kzn7jzMyFuTtk8JA7QQG1" crossorigin="anonymous">
<link rel="stylesheet" href="style.css" crossorigin="anonymous">
<!--[if IE 9]><link rel="stylesheet" href="ie.css" type="text/css" /><![endif]-->
<!--[if IE 8]><link rel="stylesheet" href="ie.css" type="text/css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="ie.css" type="text/css" /><![endif]-->
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<div class="container">
<div class="content">
<div style="display:flex; align-items:flex-start; justify-content:flex-start!important; padding:20px 0px 20px 0px; height:100%; flex-wrap:wrap;" class="wrapper">
<div class="block padding-left">
<div class="padding-mobile" style="width:100%; height:auto; display:flex; align-items:flex-start; justify-content:flex-start; margin-top:60px; flex-wrap:wrap; box-sizing:border-box;">
<h2 style="font-size:42px; margin:0px;">Apply</h2>
<form enctype="multipart/form-data" id="cv" class="formulier" method="POST" action="">
<p>
<label>First name:</label>
<input data-validation="required" type="text" name="naam" placeholder="Uw naam" />
</p>
<p>
<label>Last name:</label>
<input data-validation="required" type="text" name="achternaam" placeholder="Uw achternaam" />
</p>
<p>
<label>Telephone</label>
<input data-validation="required" type="text" name="telefoon" placeholder="Uw telefoonnummer" />
</p>
<p>
<label>Email address</label>
<input data-validation="required email" type="text" name="email" placeholder="Uw email adres" />
</p>
<p>
<label>Select a job application</label>
<select name="vacature" placeholder="Vacature" data-validation="length" data-validation-length="min1" data-validation-error-msg="Selecteer een vacature">
<option value="" disable selected>Vacature</option>
<option>- Open sollicitatie- </option>
<option>Administratief medewerker bedrijfskantoor (m/v)</option>
<option>Inkoper</option>
<option>Leerling Operators</option>
<option>Snijder (m/v)</option>
<option>Planner</option>
<option>Accountmanager Frankrijk</option>
<option>Offsetdrukker Vellen</option>
<option>Oproepkrachten</option>
<option>Weekend-/ vakantiewerkers</option>
<option>Assistent Machineoperator (m/v)</option>
<option>Offsetrotatiedrukkers Heatset (m/v)</option>
<option>Software developer</option>
<option>Allround onderhoudsmonteur</option>
<option>Magazijnmedewerker (m/v)</option>
</select>
</p>
<p style="background:#fff; padding:20px; margin-top:44px; color:#000; border-radius:6px;">
<label style="color:#555; text-shadow:none!important; font-size:18px;">Upload your CV</label>
<input type="file" name="cv" data-validation="mime size" data-validation-allowing="pdf, docx, doc, docm, rtf" data-validation-max-size="2M" />
</p>
<p align="center">Please vrify that you are human.</p>
<div class="g-recaptcha" data-sitekey="---sitekey----" style="margin-bottom:20px;" align="center"></div>
<input type="submit" value="Verzend mijn sollicitatie!" />
</form>
<script>
$("form#cv")
.attr("enctype", "multipart/form-data")
.attr("encoding", "multipart/form-data");
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
<script>
$.validate({
modules: 'file',
lang: 'nl'
});
</script>
</div>
</div>
<div class="block">
<div class="circle" style="border-radius:600px; border:solid 10px #fff; margin-top:60px; background:url(wrapper.png); background-size:160% auto!important; background-position:-150px 0!important; box-sizing:border-box;"></div>
</div>
<div class="clear"></div>
<div class="block padding-left inline-block">
<div style="text-align:center; display:flex; align-items:center; justify-content:center; width:90%;">
<?php
if(isset($_POST['email'])) {
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
echo '<div class="notific" style="background:rgba(192, 0, 0, 0.8); display:flex; align-items:center; justify-content:center; border-radius:6px; margin-top:20px; padding:0px 15px 0px 15px;"><i style="margin:0px 10px 0px 10px; color:#fff; font-size:32px; text-shadow: 1.2px 1.2px 1.2px #000;" class="fas fa-exclamation-triangle"></i><h2 style="font-size:28px!important;">Bevestig dat u een mens bent.</h2></div>';
?>
<script>
$('html, body').animate({
scrollTop: $("div.notific").offset().top
}, 1000)
</script>
<?php
exit;
}
$secretKey = "--secretkey--";
$ip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys["success"]) !== 1) {
echo '<div class="notific" style="background:rgba(192, 0, 0, 0.8); display:flex; align-items:center; justify-content:center; border-radius:6px; margin-top:20px; padding:0px 15px 0px 15px;"><i style="margin:0px 10px 0px 10px; color:#fff; font-size:32px; text-shadow: 1.2px 1.2px 1.2px #000;" class="fas fa-exclamation-triangle"></i><h2 style="font-size:28px!important;">Er ging iets mis, probeer het nog eens.</h2></div>';
?>
<script>
$('html, body').animate({
scrollTop: $("div.notific").offset().top
}, 1000)
</script>
<?php
} else {
echo '<div class="notific" style="background:rgba(0, 226, 37, 0.8); display:flex; align-items:center; justify-content:center; border-radius:6px; margin-top:20px; padding:0px 15px 0px 15px;"><i style="margin:0px 10px 0px 10px; color:#fff; font-size:32px; text-shadow: 1.2px 1.2px 1.2px #000;" class="fas fa-check-square"></i><h2 style="font-size:28px!important;">Bedankt voor uw aanmelding.</h2></div>';
?>
<script>
$('html, body').animate({
scrollTop: $("div.notific").offset().top
}, 1000)
</script>
<?php
}
}
?>
</div>
</div>
</div>
</div>
<?php
if(isset($_POST['email']) && isset($_FILES['cv'])) {
$naam = $_POST['naam'];
$achternaam = $_POST['achternaam'];
$telefoon = $_POST['telefoon'];
$email = $_POST['email'];
$vacature = $_POST['vacature'];
$to = 'email#email.com';
$from = 'email#email.com';
$subject = 'Nieuwe sollicitatie op vacature';
$message = "<p><b>Details sollicitatie:</b></p>
<p>Naam: $naam </p>
<p>Achternaam: $achternaam </p>
<p>Telefoon: $telefoon </p>
<p>Email: $email </p>
<p>Vacature: $vacature</p>
</html>
";
$file_tmp_name = $_FILES['cv']['tmp_name'];
$file_name = $_FILES['cv']['name'];
$file_size = $_FILES['cv']['size'];
$file_type = $_FILES['cv']['type'];
$file_error = $_FILES['cv']['error'];
//read from the uploaded file & base64_encode content for the mail
$handle = fopen($file_tmp_name, "r");
$content = fread($handle, $file_size);
fclose($handle);
$encoded_content = chunk_split(base64_encode($content));
$boundary = md5("em");
//header
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From:".$from."\r\n";
$headers .= "Reply-To: ".$to."" . "\r\n";
$headers .= 'Cc: cc#email.com' . "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";
//plain text
$body = "--$boundary\r\n";
$body .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode($message));
//attachment
$body .= "--$boundary\r\n";
$body .="Content-Type: $file_type; name=".$file_name."\r\n";
$body .="Content-Disposition: attachment; filename=".$file_name."\r\n";
$body .="Content-Transfer-Encoding: base64\r\n";
$body .="X-Attachment-Id: ".rand(1000,99999)."\r\n\r\n";
$body .= $encoded_content;
mail($to, $subject, $body, $headers, '-f email#email.com');
} else {}
if(isset($_POST['email']) && !isset($_FILES['cv'])) {
$naam = $_POST['naam'];
$achternaam = $_POST['achternaam'];
$telefoon = $_POST['telefoon'];
$email = $_POST['email'];
$vacature = $_POST['vacature'];
$to = 'email#email.com';
$from = 'email#email.com';
$subject = 'Nieuwe sollicitatie op vacature';
$message = "<p><b>Details sollicitatie:</b></p>
<p>Naam: $naam </p>
<p>Achternaam: $achternaam </p>
<p>Telefoon: $telefoon </p>
<p>Email: $email </p>
<p>Vacature: $vacature</p>
</html>
";
$file_tmp_name = $_FILES['cv']['tmp_name'];
$file_name = $_FILES['cv']['name'];
$file_size = $_FILES['cv']['size'];
$file_type = $_FILES['cv']['type'];
$file_error = $_FILES['cv']['error'];
//read from the uploaded file & base64_encode content for the mail
$handle = fopen($file_tmp_name, "r");
$content = fread($handle, $file_size);
fclose($handle);
$encoded_content = chunk_split(base64_encode($content));
$boundary = md5("sanwebe");
//header
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From:".$from."\r\n";
$headers .= "Reply-To: ".$to."" . "\r\n";
$headers .= 'Cc: cc#email.com' . "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";
//plain text
$body = "--$boundary\r\n";
$body .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode($message));
//attachment
$body .= "--$boundary\r\n";
$body .="Content-Type: $file_type; name=".$file_name."\r\n";
$body .="Content-Disposition: attachment; filename=".$file_name."\r\n";
$body .="Content-Transfer-Encoding: base64\r\n";
$body .="X-Attachment-Id: ".rand(1000,99999)."\r\n\r\n";
$body .= $encoded_content;
mail($to, $subject, $body, $headers, '-f email#email.com ');
} else {}
?>
</body>
</html>
It has been my experience that this type of situation is not related to your code. You could check your phpmail.log but I suspect you will see all of your emails listed.
The key here is that the CC is always received. That means your emails are being sent but not delivered. This points to your DNS configuration. It may be your SPF record, or lack of a DKIM entry.
Since you are using PHP's mail() function, you are not sending via authenticated SMTP. I would second #CBroe's recommendation to use a mail library, but for a different reason. It will provide you the option of using authenticated SMTP which will have a much higher possibility of delivery.
I would recommend:
Check your SPF Record and make sure it includes your server's IP address. Preferably it will end with "-all" (avoid "+all").
Use a PHP mail library and use authenticated SMTP. This isn't a requirement, but it makes coding email faster, easier and less error prone. Authenticated SMTP never hurts your chances of delivery.
If possible, set up the DKIM record for your domain.
Related
Following is my php code for email function which is not sending email and i am not getting where the mistake is. Form data is posting properly but mail is not going.
$imgSrc = "logo1.png";
$bg = "background.jpg";
$subjectPara1 = "Dear admin";
$subjectPara2 = $_POST["message"];
$subjectPara4 = $_POST["email"];
$subject = $_POST["subject"];
$subjectPara3 = $_POST["author"];
$message = '<!DOCTYPE HTML><html>'.
'<head>'.
'<title>Email notification</title>'.
'</head>'.
'<body style="background-image: url('.$bg.');background-size: cover;">'.
'<div id="header" style="width: 80%;height: 60px;margin: 0 auto;padding: 10px;color: #fff;text-align: left;font-family: Open Sans,Arial,sans-serif;">'.
'<img height="50" width="220" style="border-width:0" src="'.$imgSrc.'" >'.
'</div>'.
'<div id="outer" style="width: 80%;margin: 0 auto;margin-top: 10px;">'.
'<div id="inner" style="width: 78%;font-family: inherit;font-size: 15px;font-weight: normal;line-height: 1.4em;color: #fff;margin-top: 10px;">'.
'<p>'.$subjectPara1.'</p>'.
'<p>'.$subjectPara2.'</p>'.
'<p><br/>Regards,<br/>'.$subjectPara3.'</p>'.
'<p>'.$subjectPara4.'</p>'.
'</div>'.
'</div>'.
'<div id="footer" style="width: 80%;height: 40px;text-align: center; padding: 10px; font-family: inherit; font-size: 15px; color: #fff;">'.
'All rights reserved # 2016'.
'</div>'.
'</body></html>';
$to = 'test#exmple.com';
$from = $subjectPara4;
$headers = 'From: test#exmple.com\r\n';
$headers .= 'Reply-To: test#exmple.com\r\n';
$headers .= 'MIME-Version: 1.0\r\n';
$headers .= 'Content-Type: text/html; charset=ISO-8859-1\r\n';
if(mail($to, $subject, $message, $headers))
{
echo "<script>window.location='index.php';</script>";
}
Kindly help me to resolve this.
I have a 15 letter code that seems to add itself at the end of emails I send.
This code seems to change every email batch I send (if I send multiple emails via a loop, they all have the same code, but next time I send multiple emais, the code is different) and the code always seem to be 15 characters.
So does anybody know where this code might be coming from, and how to prevent it?
I'm using the default PHP mail() function.
Edit:
Heres a snippet of the code generating the Email.
$boundary = uniqid('np');
$headers = 'From: This.Site <no-reply#This.Site>' . "\r\n" .
'Reply-To: no-reply#This.Site' . "\r\n" .
"MIME-Version: 1.0" . "\r\n" .
"Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n".
'X-Mailer: PHP/' . phpversion();
mail($email, 'Subject - '.$title.' - Client Name', create_notif_email($name, $compagnieFrom, $title, $link, $boundary), $headers);
function create_notif_email($name, $compagnieFrom, $title, $link, $boundary){
$urlSite = get_bloginfo('url');
$html = '';
$html .= file_get_contents(__DIR__.'/plaintext.txt');
$html .= "\r\n\r\n--" . $boundary . "\r\n";
$html .= "Content-type: text/plain;charset=utf-8\r\n\r\n";
$html .= file_get_contents(__DIR__.'/plaintext.txt');
$html .= "\r\n\r\n--" . $boundary . "\r\n";
$html .= "Content-type: text/html;charset=utf-8\r\n\r\n";
$html .= file_get_contents(__DIR__.'/mail.html');
$html .= $boundary;
$html = str_replace('[NOM]', $name, $html);
$html = str_replace('[FROM]', $compagnieFrom, $html);
$html = str_replace('[TITLE]', $title, $html);
$html = str_replace('[LINK]', ''.$link.'', $html);
$html = str_replace('[URLSITE]', $urlSite, $html);
return $html;
}
mail.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Nouveau poste pour vous! - [TITLE] - Bestaff</title>
</head>
<body style="width:100%; margin:0; padding:0; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;">
<!-- body wrapper -->
<table cellpadding="0" cellspacing="0" border="0" style="margin:0; padding:0; width:100%; line-height: 100% !important;">
<tr>
<td valign="top">
<!-- edge wrapper -->
<!-- ///////////////////////////////////////////////////// -->
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td width="20"></td>
<td valign="top" style="vertical-align: top; text-align:left;">
<br /><img src="[URLSITE]/images/image.png" alt="Bestaff.in" title="Bestaff.in"/><br />
<div style="font-family:Arial, sans-serif; font-size:14px; line-height:18px;">
<br /><i>English version follows</i><br /><br />
Bonjour [NOM],<br /><br />
[FROM] [TITLE].<br /><br />
[LINK]<br /><br />
Bonne chance!<br /></br>
<i style="font-style=12px"></i>
<br /> <hr /><br />
Hello [NOM],<br /><br />
[FROM][TITLE].<br /><br />
[LINK]<br /><br />
Good luck!<br /></br>
<i style="font-style=12px"></a></i><br />
</div>
</td>
<td width="20"></td>
</tr>
</table>
</td>
</tr>
</table>
<!-- / page wrapper -->
</body>
</html>
and plaintext.txt
English version follows
Bonjour [NOM],
[FROM][TITLE].
[LINK]
Bonne chance!
Hello [NOM],
[FROM][TITLE].
[LINK]
Good luck!
Boundary id typically start with double dash and are followed immediatly by a line break
Try this....
Change
$html .= $boundary;
to
$html .= '--'.$boundary.'
';
source:https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
I wanted to send unique confirmation link to multiple users, that user list get from the database mysql. I tried using the following code, but it send only the first user not all.
<?php
$get_ref_q = mysql_query("select * from $referal_details where ser_fk='$last_insert_id'");
$get_last_ref_value = mysql_num_rows($get_ref_q);
$z=1;
if($get_last_ref_value > 0)
{
//$user_email = array();
while($sel_per_fet = mysql_fetch_assoc($get_ref_q))
{
$rf_name = $sel_per_fet['rf_name'];
$dy_link = $sel_per_fet['dy_link'];
$user_email = $sel_per_fet['rf_email'];
$userhtml = '<html>
<body style="width:100%; font-family:Arial; font-size:13px; line-height:22px; background:#fff; position:relative;color:#555555; margin:0px; padding:0px;">
<div style="margin:0 auto; width:600px;">
<div style="background:#fff; width:594px; float:left;border:#2fb25d 3px solid;">
<div style="padding:27px; width:540px; float:left;text-align:center; border-bottom:#2fb25d 3px solid;">
</div>
<div style="background:#fff; padding:44px 34px; width:526px; float:left;">
<h1 style="color:#000; font-size:20px; font-family:Arial; font-weight:normal; margin-bottom:20px;">
Dear '.$rf_name.' <br />
</h1>
<p>Vetri has refered you for this servey</p>
<p>please find your servey link</p>
<p>'.$uri.'/index.php?token='.$dy_link.'</p>
</div>
</div>
</div>
</body>
</html>';
$user_subject = 'Vetri has refered you for this servey';
$user_message = $userhtml;
$user_headers .= 'MIME-Version: 1.0' . "\r\n";
$user_headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$user_headers .= "From: Servey <$comp_email> \r\n";
mail($user_email,$user_subject,$user_message,$user_headers,"-f$comp_email");
$z++;
}
}
?>
Note: I already have $last_insert_id value. I wanted to send unique email content to each users, not the common contend. Thanks in advance.
Your code looks good - apart from one tiny issue:
$user_headers .= 'MIME-Version: 1.0' . "\r\n";
---------------^
This line does not need the ., and it is likely that subsequent emails are adding more and more identical headers to $user_headers, causing subsequent messages to fail.
I am sending a newsletter using the following code I am going to post. I have a $to variable that is for email addresses in my database. I use a while loop to send an email for each email address in my database to preserve privacy. At the bottom of the email I have a link for unsubscribing which is linked to a simple script that has the users email in the link. The $to variable is not working in the link though. The email sends but when I look to see if it sent all the data the link looks like http://example.com/scripts/php/unsubscribe.php?email= instead of http://example.com/scripts/php/unsubscribe.php?email=example#email.com.
I'm not sure what I've done wrong here since I am getting no errors, and the script is working except for sending the email in the link.
require('/home/jollyrogerpcs/public_html/settings/globalVariables.php');
require('/home/jollyrogerpcs/public_html/settings/mysqli_connect.php');
mysqli_select_db($conn,"newsletterlist");
$query = "SELECT * FROM newsletterusers";
$result = mysqli_query($conn, $query);
$subject = str_ireplace(array("\r", "\n", '%0A', '%0D'), '', $_POST['subject']);
$message = str_ireplace(array("\r", "\n", '%0A', '%0D'), '', $_POST['body']);
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: Jesse Elser<jesse#jollyrogerpcs.com>' . "\r\n";
if (!$result) exit("The query did not succeded");
else {
while ($row = mysqli_fetch_array($result)) {
$to = $row['email'];
$date = date("m/d/Y h:i:sa");
$body ='<!DOCTYPE HTML>';
$body .='<body style="padding: 0; margin: 0; background-color: #000; color: #fff; text-align: center; font-family: verdana;">';
$body .='<div id="container" style="width: 90%; margin: 0 auto; text-align: left; background-color: #121212;">';
$body .='<div id="header" style="border-bottom: 1px solid #ff6400;">';
$body .='<img src="http://jollyrogerpcs.com/images/main/logo.png" width="100%">';
$body .='</div>';
$body .='<div id="subject" style="background-color: #121212; text-align: center;">';
$body .='<h1 style="color: #ff6400; margin: 0;">'.$subject.'</h1>';
$body .='</div>';
$body .='<div id="message" style="background-color: #232323; color: #fff; padding: 10px;">';
$body .= $message;
$body .='</div>';
$body .='<div id="footer" style="background-color: #121212; padding: 10px;">';
$body .='Visit Our Site | Thanks for subscribing to our newsletter! | Unsubscribe <br> E-mail sent: ';
$body .= $date;
$body .='</div>';
$body .='</body>';
mail($to,$subject,$body,$headers);
}
}
mysqli_close($conn);
header('Location: http://jollyrogerpcs.com/newsletter.php');
You are closing the href attribute before the email address is included so...
<a href="http://example.com/scripts/php/unsubscribe.php?email="'.$to.'"
Should be
<a href="http://example.com/scripts/php/unsubscribe.php?email='.$to.'"
As is it would render as
<a href="http://example.com/scripts/php/unsubscribe.php?email=" email#address.com"....
Which would make the link http://example.com/scripts/php/unsubscribe.php?email=.
I have an Html site.In that there have form for sending mail in Each page.The form action is done in another page that is process.php page.I want to redirect from php page to html page after sending mail.
This is my html code
<form name="mail" id="mail" method="post" action="process.php" onSubmit="return valid_form();">
<div class="form_bg11">
<div class="free_call_back">Free Callback Request</div>
<input name="txtname" id="txtname" type="text" class="free_cal_field" value="Your Name" onClick="(this.value='')" >
<input name="txtphone" id="txtphone" type="text" class="free_cal_field" value="Your Phone Number" onClick="(this.value='')">
<input type="submit" name="Submit" style="background-image: url('images/submit.png'); border: 0px none; height: 19px; margin-left: 85px; width: 56px; margin-top:5px;" value=" ">
</div>
</form>
Thi is my process.php page
<?php
if(isset($_POST['Submit']))
{
$name = $_POST['txtname'];
$phone = $_POST['txtphone'];
$to = "mariyadavis90#gmail.com";
$subject = "New Request Come !";
$message = '<div style="background-color: #EEEEEE;border-bottom: 1px solid #DCDCDC;padding: 10px 0 20px;width: 400px;">
<div style="width:400px;">
<div style="width:400px;background-color:#eeeeee;padding: 10px 0 20px;border-bottom:1px solid #dcdcdc;">
<div style="width:300px; text-align:center;color:#666666;margin-left:20px;font-size:12px;font-weight:bold;">
Now you got a new request from :
</div>
</div> <!--end of div_form_main-->
<div style="width:400px;background-color:#eeeeee;padding: 10px 0 20px;border-bottom:1px solid #dcdcdc;">
<div style="float:left;width:150px;color:#666666;margin-left:20px;font-size:12px;font-weight:bold;"> Name:</div>
<div style="float:left;width:auto;color:#000000;font-size:12px;font-weight:bold;">'.$name.'</div>
</div> <!--end of div_form_main-->
<!--end of div_form_main-->
<div style="width:400px;background-color:#eeeeee;padding: 10px 0 20px;border-bottom:1px solid #dcdcdc;">
<div style="float:left;width:150px;color:#666666;margin-left:20px;font-size:12px;font-weight:bold;"> Phone Number:</div>
<div style="float:left;width:auto;color:#000000;font-size:12px;font-weight:bold;">'.$phone.'</div></div> <!--end of div_form_main-->
</div> <!--end of div_password_main-->';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .="Content-Transfer-Encoding: 8bit";
if(!mail($to, $subject, $message, $headers))
{
$msg = "Sending mail is failed !";
}
else
{
$msg = "Mail send Successfully !";
}
print "<script type=\"text/javascript\">";
print "alert('".$msg."')";
print "</script>";
}
?>
how can i do this?
I am a bit confused by your wording. Why can't you just use the PHP header() function?
header('Location: http://www.example.com/');
you can modify your procss.php (in your javascript block)
print "<script type=\"text/javascript\">";
print "alert('".$msg."')";
print "window.location.href='http://www.yourdomain/yourhtmlpage.html'";
print "</script>";
A quick write up
if(!mail($to, $subject, $message, $headers))
{
$msg = "Sending mail is failed !";
}
else
{
$msg = "Mail send Successfully !";
print "<script type=\"text/javascript\">";
print "window.location.href= 'www.example.com' ";
print "</script>";
}
print "<script type=\"text/javascript\">";
print "alert('".$msg."')";
print "</script>";