i need to send a resume as attachment to a particular mail id...
its my form. - <form method="POST" name="email" action="sendmail.php" enctype="multipart/form-data" onsubmit="return validateForm()";>
-
-
<table border=0 cellPadding=5 cellSpacing=10 width=100%>
-
-
<tr>
-
<td><label for='name'>Name:</label></td>
-
<td><input type="text" name="name" maxlength="50" size="30"></td>
-
</tr>
-
<tr>
-
<td><label for='familyname'>Family Name:</label></td>
-
<td><input type="text" name="fname" maxlength="50" size="30"></td>
-
</tr>
-
<tr>
-
<td><label for='age'>Age:</label></td>
-
<td><input type="text" name="age" maxlength="50" size="30"></td>
-
</tr>
-
<tr>
-
<td><label for='experience'>Years of Experience:</label></td>
-
<td><input type="text" name="exp" maxlength="50" size="30"></td>
-
</tr>
-
<tr>
-
<td><label for='university'>University Attened:</label></td>
-
<td><input type="text" name="university" maxlength="50" size="30"></td>
-
</tr>
-
<tr>
-
<td><label for='phone'>Phone Number:</label></td>
-
<td><input type="text" name="phone" maxlength="50" size="30"></td>
-
</tr>
-
<tr>
-
<td><label for='resume'>Resume:</label></td>
-
<td><input type="file" name="resume"></td>
-
</tr>
-
<tr>
-
<td colSpan=2 align=center><input class=subbtn type="submit" value="Submit" name='submit' /></td>
-
</tr>
-
-
</table>
-
</form>
its my sendmail.php (without file attachment part) - <?php
-
$name=$_POST['name'];
-
$fname=$_POST['fname'];
-
$age=$_POST['age'];
-
$exp=$_POST['exp'];
-
$university=$_POST['university'];
-
$phone=$_POST['phone'];
-
-
$email_to='rajletsgetlost@gmail.com';
-
-
$emailsubject=ucfirst($name).' Resume';
-
$body.="Hi,\n";
-
$body.="Please find Mr.".$name." details below:\n\n";
-
$body.="Name: ".$name."\n";
-
$body.="Family Name: ".$fname." \n";
-
$body.="Age: ".$age." \n";
-
$body.="Experience: ".$exp." \n";
-
$body.="University: ".$university." \n";
-
$body.="Phone: ".$phone." \n";
-
-
mail("rajletsgetlost@gmail.com", $emailsubject,
-
$body, "From:" . $name);
-
header("location: thanks.php");
it works fine without attachment...
sendmail.php (file attachment part) - $fileatt =$_FILES['resume']['tmp_name']; // Path to the file
-
$fileatt_type = "application/octet-stream"; // File Type
-
$fileatt_name = $_FILES['resume']['name']; // Filename that will be used for the file as the attachment
-
-
-
$file = fopen($fileatt,'rb');
-
$data = fread($file,filesize($fileatt));
-
fclose($file);
-
-
-
$semi_rand = md5(time());
-
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
-
-
$headers .= "\nMIME-Version: 1.0\n" .
-
"Content-Type: multipart/mixed;\n" .
-
" boundary=\"{$mime_boundary}\"";
-
-
$body.= "This is a multi-part message in MIME format.\n\n" .
-
"--{$mime_boundary}\n" .
-
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
-
"Content-Transfer-Encoding: 7bit\n\n" .
-
$body. "\n\n";
-
-
$data = chunk_split(base64_encode($data));
-
-
$body.= "--{$mime_boundary}\n" .
-
"Content-Type: {$fileatt_type};\n" .
-
" name=\"{$fileatt_name}\"\n" .
-
"Content-Disposition: attachment;\n" .
-
" filename=\"{$fileatt_name}\"\n" .
-
"Content-Transfer-Encoding: base64\n\n" .
-
$data . "\n\n" .
-
"--{$mime_boundary}--\n";
please help how to attach the file???
5 8564 zmbd 5,501
Expert Mod 4TB
impin BEWARE!
If you use third party software as suggested by Luuk, you do so at your own risk.
Luuk 1,047
Expert 1GB
yes, of course you do that at your own risk.....
But using PHP would that also not be, to him, 'using 3rd party software' ?
;-)
zmbd 5,501
Expert Mod 4TB
Luuk, Semantics; and by your reasoning so would the MS Windows operating system, UNIX (or its flavors), any browser, and so forth... besides you know what I mean by third party.
However, if not let me elucidate: - OP = 1st party
- Members at this site providing open source guidance = 2nd party. The fact that the code is being reviewed by other members, experts, moderators, and admins provide some reassurance that OP should be provided generally safe code.
- Links provided to pre-compiled code = 3rd party.
- Worse, the link you provided now asks the referred party to goto yet another link. So from sourceforge now to github.
Technically, your post with the link is off topic as it does not directly answer OP's question; however, because it appeared to be shareware/freeware and fairly well used vs. commercial I didn't delete it... now, in retrospect perhaps I should have?
Luuk 1,047
Expert 1GB
@zmbd: thanks
@impin:
line 14: - $headers .= "\nMIME-Version: 1.0\n"
i dont think the initial "\n" should be there?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: knoak |
last post by:
Hi Pedro,
I know i have to read a lot. :) But sometimes
i need a little help from my friends, because i
am the only one in my environment that experiments
with php who could help me.. :(
Few...
|
by: Fraser S |
last post by:
Hi, I am receiving an invalid mail Attachment error when trying to
send an attachment using System.Web.Mail. I have read other posts on
these errors and have since checked that the asp.net account...
|
by: Cutlass |
last post by:
Hello
I'm using the following code to send mail from VB.NET 2003
oMail.SmtpServer = "xxx.xxx.com"
Mailmsg.To = "joe@xxx.com"
Mailmsg.From = "\Joe Blow\"
Mailmsg.BodyFormat = MailFormat.Html...
|
by: JohnG |
last post by:
Hi guys,
Anyone give me a clue why this code doesn't work
-------------------------------------
Public Function MailIt()
On Error GoTo MailIt_Err
DoCmd.SendObject acSendTable, "tblXXYY",...
|
by: bluewind44 |
last post by:
Is there any way to send mail attachment from stream or binary?
Because I design my solution to save files in DB not in physical files,
I wanna send files to mail attachments directly.
@.@
|
by: Robbie De Sutter |
last post by:
Hello,
How do I open a new, empty e-mail message from the default e-mail client
whereby the sender is given and a file is attached?
Currently I use the command (vb.net):
---...
|
by: theWizard1 |
last post by:
The following sends my email, but the attachment is empty. The attachment
should contain the data that is in the string that was created from the
xmlReader.
I have a stored procedure written...
|
by: Ray |
last post by:
Hi
Can anyone help with something that has beaten me.
I am sending an email with an attachment, as per below. If I comment out the
MailAttachment line then the mail gets sent, but with it in I...
|
by: vinodkus |
last post by:
dear sir/maadm
I have to send a mail attachment but my problem is that file name of
my attachment should be changed that i will write in a text box.
please suggest any solution
Thanks in...
|
by: Chitu03 |
last post by:
Hi
I am already send a mail using Php with some attachement into it. My Problem is the attachement file is in my Database(mysql). I don't know how can i get from database and then add to my mail....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |