Good Day
I have published a website and everything works expect for my forms. I can't seem to send the attachments to the email address according to the uploader. I don't know what i am doing wrong please help ............... .....i really need serious help
the field picture2, picture4 and video are uploaders
[php]<?php
$firstname = $_POST['FirstName'];
$lastname = $_POST['LastName'];
$email = $_POST['EmailAddress'];
$number = $_POST['ContactNumber'];
$NameOfAdvertis edItem = $_POST['NameOfAdvertis edItem'];
$Genres = $_POST['Genres'];
$Format = $_POST['Format'];
function mail_attachment ($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename ;
$file_size = filesize($file) ;
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle) ;
$content = chunk_split(bas e64_encode($con tent));
$uid = md5(uniqid(time ()));
$name = basename($file) ;
$header = "From: ".$from_nam e." <".$from_mail." >\r\n";
$header .= "Reply-To: ".$replyto."\r\ n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$u id."\"\r\n\r\n" ;
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\ n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\ r\n";
$header .= "--".$uid."\r\ n";
$header .= "Content-Type: application/octet-stream; name=\"".$filen ame."\"\r\n"; // use diff. tyoes here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$f ilename."\"\r\n \r\n";
$header .= $content."\r\n\ r\n";
$header .= "--".$uid."--";
if (mail($mailto, $subject, "", $header)) {
echo = "mail send ... OK"; // or use booleans here
} else {
echo = "mail send ... ERROR!";
}
}
// how to use
$my_file = "somefile.z ip";
$my_path = $_SERVER['DOCUMENT_ROOT']."/Main/Sign_up/upload/";
$my_name = "Olaf Lederer";
$my_mail = "mainsignup@con tiads.co.za";
$my_replyto = "info@contiads. co.za";
$my_subject = "This is a mail with attachment for ads.";
$my_message = "Hallo,\r\n do you like this script? I hope it will help.\r\n\r\ngr . Olaf";
mail_attachment ($my_file, $my_path, "mainsignup@con tiads.co.za", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
$Picture2 = $_POST['Picture2'];
$Picture4 = $_POST['Picture4'];
$video = $_POST['video'];
$ShortDescripti on = $_POST['ShortDescripti on'];
$country = $_POST['country'];
$Province = $_POST['Province'];
$CityTown = $_POST['CityTown'];
$Duration = $_POST['Duration'];
$tnc_agree = $_POST['tnc_agree'];
$to = "ContiAds! <mainsignup@con tiads.co.za>";
$subject = "RE: New ContiAds SignUp!";
$body = "<html>".
"<head>".
"<title>Con tact Request</title>".
"<style type='text/css'>".
"body,td,th {".
"font-family: Geneva, Arial, Helvetica, sans-serif;".
"font-size: 12px;".
"}".
".style1 {font-size: 24px}".
"</style></head>".
"<body>".
"<p align='center' class='style1'> ContiAds New Signup</p>".
"<table width='498' border='0' align='center' cellpadding='5' cellspacing='0' >".
"<tr>".
"<td colspan='2' valign='top' bgcolor='#33333 3' height='2px'></td>".
"</tr>".
"<tr>".
"<td width='104' valign='top'>Fu ll Name:</td>".
"<td width='374'>".$ firstname." ".$lastname ."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Co ntact Number:</td>".
"<td>".$number. "</td>".
"</tr>".
"<tr>".
"<td valign='top'>E-mail Address:</td>".
"<td>".$email." </td>".
"</tr>".
"<tr>".
"<td valign='top'>Nu mber of Advertised Items:</td>".
"<td>".$NameOfA dvertisedItem." </td>".
"</tr>".
"<tr>".
"<td valign='top'>Ge nres:</td>".
"<td>".$Genres. "</td>".
"</tr>".
"<tr>".
"<td valign='top'>Fo rmat:</td>".
"<td>".$Format. "</td>".
"</tr>".
"<tr>".
"<td valign='top'>Sh ort Description:</td>".
"<td>".$ShortDe scription."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Co untry:</td>".
"<td>".$country ."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Pr ovince:</td>".
"<td>".$Provinc e."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Ci ty / Town:</td>".
"<td>".$CityTow n."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Du ration:</td>".
"<td>".$Duratio n."</td>".
"</tr>".
"<tr>".
"<td colspan='2' valign='top' bgcolor='#33333 3' height='2px'></td>".
"</tr>".
"</table>".
"</body>".
"</html>";
//Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=is o-8859-1" . "\r\n";
$headers .= 'From: ' . $email . "\r\n";
//$headers .= 'Cc: myboss@example. com' . "\r\n";
if (mail($to, $subject, $body, $headers)) {
?>
<script language="javas cript" type="text/javascript">
location.replac e("Sign%20Up%20 Success.htm");
</script>
<?php
} else {
?>
<script language="javas cript" type="text/javascript">
location.replac e("Sign%20Up%20 Failure.htm");
</script>
<?php
}?>[/php]
Please do not use uppercase cries for help and enclose your code within the appropriate code tags! See the Posting Guidelines on this. - moderator
I have published a website and everything works expect for my forms. I can't seem to send the attachments to the email address according to the uploader. I don't know what i am doing wrong please help ............... .....i really need serious help
the field picture2, picture4 and video are uploaders
[php]<?php
$firstname = $_POST['FirstName'];
$lastname = $_POST['LastName'];
$email = $_POST['EmailAddress'];
$number = $_POST['ContactNumber'];
$NameOfAdvertis edItem = $_POST['NameOfAdvertis edItem'];
$Genres = $_POST['Genres'];
$Format = $_POST['Format'];
function mail_attachment ($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename ;
$file_size = filesize($file) ;
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle) ;
$content = chunk_split(bas e64_encode($con tent));
$uid = md5(uniqid(time ()));
$name = basename($file) ;
$header = "From: ".$from_nam e." <".$from_mail." >\r\n";
$header .= "Reply-To: ".$replyto."\r\ n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$u id."\"\r\n\r\n" ;
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\ n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\ r\n";
$header .= "--".$uid."\r\ n";
$header .= "Content-Type: application/octet-stream; name=\"".$filen ame."\"\r\n"; // use diff. tyoes here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$f ilename."\"\r\n \r\n";
$header .= $content."\r\n\ r\n";
$header .= "--".$uid."--";
if (mail($mailto, $subject, "", $header)) {
echo = "mail send ... OK"; // or use booleans here
} else {
echo = "mail send ... ERROR!";
}
}
// how to use
$my_file = "somefile.z ip";
$my_path = $_SERVER['DOCUMENT_ROOT']."/Main/Sign_up/upload/";
$my_name = "Olaf Lederer";
$my_mail = "mainsignup@con tiads.co.za";
$my_replyto = "info@contiads. co.za";
$my_subject = "This is a mail with attachment for ads.";
$my_message = "Hallo,\r\n do you like this script? I hope it will help.\r\n\r\ngr . Olaf";
mail_attachment ($my_file, $my_path, "mainsignup@con tiads.co.za", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
$Picture2 = $_POST['Picture2'];
$Picture4 = $_POST['Picture4'];
$video = $_POST['video'];
$ShortDescripti on = $_POST['ShortDescripti on'];
$country = $_POST['country'];
$Province = $_POST['Province'];
$CityTown = $_POST['CityTown'];
$Duration = $_POST['Duration'];
$tnc_agree = $_POST['tnc_agree'];
$to = "ContiAds! <mainsignup@con tiads.co.za>";
$subject = "RE: New ContiAds SignUp!";
$body = "<html>".
"<head>".
"<title>Con tact Request</title>".
"<style type='text/css'>".
"body,td,th {".
"font-family: Geneva, Arial, Helvetica, sans-serif;".
"font-size: 12px;".
"}".
".style1 {font-size: 24px}".
"</style></head>".
"<body>".
"<p align='center' class='style1'> ContiAds New Signup</p>".
"<table width='498' border='0' align='center' cellpadding='5' cellspacing='0' >".
"<tr>".
"<td colspan='2' valign='top' bgcolor='#33333 3' height='2px'></td>".
"</tr>".
"<tr>".
"<td width='104' valign='top'>Fu ll Name:</td>".
"<td width='374'>".$ firstname." ".$lastname ."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Co ntact Number:</td>".
"<td>".$number. "</td>".
"</tr>".
"<tr>".
"<td valign='top'>E-mail Address:</td>".
"<td>".$email." </td>".
"</tr>".
"<tr>".
"<td valign='top'>Nu mber of Advertised Items:</td>".
"<td>".$NameOfA dvertisedItem." </td>".
"</tr>".
"<tr>".
"<td valign='top'>Ge nres:</td>".
"<td>".$Genres. "</td>".
"</tr>".
"<tr>".
"<td valign='top'>Fo rmat:</td>".
"<td>".$Format. "</td>".
"</tr>".
"<tr>".
"<td valign='top'>Sh ort Description:</td>".
"<td>".$ShortDe scription."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Co untry:</td>".
"<td>".$country ."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Pr ovince:</td>".
"<td>".$Provinc e."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Ci ty / Town:</td>".
"<td>".$CityTow n."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Du ration:</td>".
"<td>".$Duratio n."</td>".
"</tr>".
"<tr>".
"<td colspan='2' valign='top' bgcolor='#33333 3' height='2px'></td>".
"</tr>".
"</table>".
"</body>".
"</html>";
//Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=is o-8859-1" . "\r\n";
$headers .= 'From: ' . $email . "\r\n";
//$headers .= 'Cc: myboss@example. com' . "\r\n";
if (mail($to, $subject, $body, $headers)) {
?>
<script language="javas cript" type="text/javascript">
location.replac e("Sign%20Up%20 Success.htm");
</script>
<?php
} else {
?>
<script language="javas cript" type="text/javascript">
location.replac e("Sign%20Up%20 Failure.htm");
</script>
<?php
}?>[/php]
Please do not use uppercase cries for help and enclose your code within the appropriate code tags! See the Posting Guidelines on this. - moderator
Comment