Reply to topic
php mailing with attachment.(picture/images/word)...
harikris2007


Joined: 07 Dec 2007
Posts: 1
Location: India
Reply with quote
save this page eg.php or as u like it .
////////////////////////////////////////////////dear friends..................................
this is only the table structure foe the mailing form.

------------------------------------------------------------------------------------------------------------
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/bg.jpg" style="background-repeat:repeat-x" >
<tr>
<td colspan="3" class="content"><img src="images/becomeamodel_banner.jpg" width="563" height="155" /></td>
</tr>
<tr>
<td width="3%" class="content">&nbsp;</td>
<td width="95%" class="content">
<form action="formmail.php"name="frmBecamemodel" method="post" enctype="multipart/form-data">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" class="content">&nbsp;</td>
</tr>
<tr>
<td colspan="3" class="content">Please fill in the form below completely and we will contact you as quickly as possible. </td>
</tr>
<tr>
<td height="10" colspan="3" class="content"></td>
</tr>
<tr>
<td width="192" class="content" align="right">Title: </td>
<td width="20">&nbsp;</td>
<td width="284"><select name="cboTitle">
<option value="Mr">Mr </option>
<option value="Mrs">Mrs </option>
<option selected="selected" value="Miss">Miss </option>
</select>
</td>
</tr>
<tr>
<td height="3" colspan="3" class="content"></td>
</tr>
<tr>
<td width="192" class="content" align="right">Contact name: </td>
<td width="20">&nbsp;</td>
<td width="284"><input name="Name" type="text" id="Name" />
</td>
</tr>
<tr>
<td height="3" colspan="3" class="content"></td>
</tr>
<tr>
<td width="192" class="content" align="right">Telephone: </td>
<td width="20">&nbsp;</td>
<td width="284"><input name="Phone_No" type="text" id="Phone_No" />
</td>
</tr>
<tr>
<td height="3" colspan="3" class="content"></td>
</tr>
<tr>
<td width="192" class="content" align="right">E-mail: </td>
<td width="20">&nbsp;</td>
<td width="284"><input name="Email" type="text" id="Email" />
</td>
</tr>
<tr>
<td height="3" colspan="3" class="content"></td>
</tr>
<tr>
<td width="192" valign="middle" class="content" align="right"> About you: </td>
<td width="20">&nbsp;</td>
<td width="284"><textarea name="message" rows="5" id="message"></textarea>
</td>
</tr>
<tr>
<td height="3" colspan="3" class="content"></td>
</tr>
<tr>
<td width="192"align="right" class="content">Picture of yourself : </td>
<td width="20">&nbsp;</td>
<td width="284"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="144"><input name="strresume" type="file" id="strresume" size="39" /></td>
<td width="11">&nbsp;</td>
<td width="129"><label></label></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10" colspan="3" class="content"></td>
</tr>
<tr>
<td width="192">&nbsp;</td>
<td width="20">&nbsp;</td>
<td width="284"><a href="javascript: tosubmit()" ><img src="images/submit_btn.jpg" width="86" height="39" border="0" /></a></td>
</tr>
</table></form></td>



<td width="2%" class="content">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>






/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
formmail.php
--------------------------
<?php

$strtitle=ucfirst($_REQUEST["cboTitle"]);
$strname=ucfirst($_REQUEST["Name"]);
$stremail=$_REQUEST["Email"];
$phone=$_REQUEST["Phone_No"];
if($phone != ""){ $strno=$phone; } else { $strno="-"; }
$strcomments=ucfirst($_REQUEST["message"]);
$filename=$_FILES["strresume"]["name"];
$filetype=$_FILES["strresume"]["type"];
$filesize=$_FILES["strresume"]["size"];
$filetemp=$_FILES["strresume"]["tmp_name"];


if(true)
{
$message='<table cellspacing="0" cellpadding="8" border="0" width="400">
<tr>
<td colspan="2"></td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Name</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$strtitle.'.'.$strname.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Phone Number</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$phone.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Email</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$stremail.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td colspan="2" style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>His/Her Comments</strong></td>
</tr>
<tr bgcolor="#eeeeee">
<td colspan="2" style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$strcomments.'</td>
</tr>

<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
</table>
';
// MAIL SUBJECT
$subject = "Mail from clients";
// TO MAIL ADDRESS

$to="mail address@domain.com";

// MAIL HEADERS

$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: Name <name@name.com>\n";




// MAIL HEADERS with attachment

$fp = fopen($strresume, "rb");
$file = fread($fp, $strresume_size);

$file = chunk_split(base64_encode($file));
$num = md5(time());

//Normal headers

$headers = "From: '$strname' \r\n";
$headers .= "CC: mm@mm.com\r\n"; //optional
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; ";
$headers .= "boundary=".$num."\r\n";
$headers .= "--$num\r\n";

// This two steps to help avoid spam

$headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n";
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";

// With message

$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$headers .= "".$message."\n";
$headers .= "--".$num."\n";

// Attachment headers

$headers .= "Content-Type:".$strresume_type." ";
$headers .= "name=\"".$strresume_name."\"r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment; ";
$headers .= "filename=\"".$strresume_name."\"\r\n\n";
$headers .= "".$file."\r\n";
$headers .= "--".$num."--";



// SEND MAIL

@mail($to, $subject, $message, $headers);
fclose($fp);
echo '<font style="font-family:Verdana, Arial; font-size:16px; color:#333333; font-weight:bold">Mail has been sent Successfully.<br /></font>';
echo "<script>window.location.href='thanks.html';</script>";
}
else
{
echo '<font style="font-family:Verdana, Arial; font-size:16px; color:#F3363F; font-weight:bold">Wrong file format. Mail was not sent.</font>';
echo "<script>window.location.href='thanks.html';</script>";
}
///////thanks.html can change to any page.
?>
php mailing with attachment.(picture/images/word)...
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic