Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Emails through a Drop Down/File attachment
Old 05-03-2009, 03:41 PM Emails through a Drop Down/File attachment
ADeacon's Avatar
Experienced Talker

Posts: 32
Name: Andrew
Location: Texas
Trades: 0
I have two questions regarding a PHP form processor I'm using. The first question regards having a user select from a drop down menu what email address they would like the form data to go to. The second is how do I pass a file attachment from the form into the email that get's sent? Below is the Form Processor I'm using, which is pretty straight forward. Thanks in advance for any help you can give me.

Form Processor:

<?
///////////////////////////////////////////////////////////////////
// PERFECT //
// ------- //
// PHP E-mail Receive Form Electronic Content Text //
// File: feedback.php //
// Version: 1.7 (January 20, 2008) //
// Description: Processes a web form to read the user input and //
// then send the data to a predefined recipient. You are //
// free to use and modify this script as you like. //
// Instructions: Go to "http://www.centerkey.com/php". //
// //
// Center Key Software * www.centerkey.com * Dem T. Pilafian //
///////////////////////////////////////////////////////////////////

// Configuration Settings
$SendFrom = "Form Feedback <email@email.com>";
$SendTo = "email@email.com";
$SubjectLine = "New Full Application";
$ThanksURL = "thanks.html"; //confirmation page

// Build Message Body from Web Form Input
foreach ($_POST as $Field=>$Value)
$MsgBody .= "$Field: $Value\r\n";
$MsgBody .= "\r\n" . @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\r\n" .
$_SERVER["HTTP_USER_AGENT"];
$MsgBody = htmlspecialchars($MsgBody, ENT_NOQUOTES); //make content safe

// Send E-Mail and Direct Browser to Confirmation Page
if(!mail($SendTo, $SubjectLine, $MsgBody, $file "From: $SendFrom\r\nReply-To: $SendFrom\r\n"))
die('<h1>Error: There was an error processing your form. Please try again later.</h1>');
header("Location: $ThanksURL");
?>
ADeacon is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-04-2009, 07:16 AM Re: Emails through a Drop Down/File attachment
dark_lord's Avatar
Experienced Talker

Posts: 41
Name: Parijat Roy
Location: INDIA-KOLKATA
Trades: 0
i think you will require imap function for sending and showing attachment
No idea about the exact process
__________________
I AM THE BEAUTIFUL NIGHTMARE

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
dark_lord is offline
Reply With Quote
View Public Profile Visit dark_lord's homepage!
 
Old 05-04-2009, 08:37 AM Re: Emails through a Drop Down/File attachment
nayes84's Avatar
Extreme Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 232
Name: John
Location: Tokyo
Trades: 0
Quote:
The first question regards having a user select from a drop down menu what email address they would like the form data to go to
here is a simple html code to do the work for you
HTML Code:
<form ...>
...
<select name="sendto">
<option value="sendto1@domain.com">sendto1@domain.com</option>
<option value="sendto2@domain.com">sendto2@domain.com</option>
...
<option value="sendton@domain.com">sendton@domain.com</option>
</select>
...
</form>

Quote:
The second is how do I pass a file attachment from the form into the email that get's sent? Below is the Form Processor I'm using, which is pretty straight forward. Thanks in advance for any help you can give me.
you can use mail() function in php but you need to learn about SMTP protocol and how can you put up binary data within email message.

anyway I suggest you to use instead a ready made php script to do the work for you
I attached a code to do that with an example file "test_mail_attachment.php" for you to help you know how can you use the script.

ps. the script is not mine. I just have it as it has free copyrights and liked to share
Attached Files
File Type: zip mail_attachment.zip (1.3 KB, 2 views)
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

if(I'm("Helpful")) Add_Talkupation("nayes84");

Last edited by nayes84; 05-04-2009 at 08:44 AM..
nayes84 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Emails through a Drop Down/File attachment
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22712 seconds with 13 queries