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
button to send a copy of form back to sender. Please help?
Old 09-06-2010, 11:38 AM button to send a copy of form back to sender. Please help?
Junior Talker

Posts: 4
Name: Dayle Sheward
Trades: 0
I have a interoffice form HTML/PHP with attachments that is working great. But I would like to add a button that would allow the user to click to receive a copy. I am totally new at this, so please speak slowly
All help is appreciated!

This is a modified HiQform. So below is

Here is my HTML code (area that relates to above):

<label for="userCopyMe"><br />
Check the box if you wish to be sent a copy of this message</label>
<input type="checkbox" name="userCopyMe" id="userCopyMe" value="1" />
________________

My PHP:
<?
// mail the content
function mailIt($content, $subject, $email, $recipient, $bcc) {
global $attachuser, $attachtemp, $attachsize, $attachtype, $this_version;

$headpart = "";

// build message headers
if($email == '') $email = "noone@nowhere.ext";
$headpart = "From: $email\r\n";
$headpart .= "Reply-To: $email\r\n";
if ($bcc != '') $headpart .= "Bcc: $bcc\r\n";
$headpart .= "X-Mailer: HiQ FormMail $this_version\r\n";
$headpart .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
$headpart .= "Content-Transfer-Encoding: 7bit\r\n\r\n";

//Allow user to get a copy of the message sent to them, true or false
$copyme = true; if ($copyme)
if ($userCopyMe == "1") { echo "checked=\"checked\"";

if ($attachuser) {
// create a MIME boundary string
$boundary = md5(uniqid(time()));

// add MIME data to the message headers
$headpart = "MIME-Version:1.0\r\n";
$headpart .= "From: $email\r\n";
$headpart .= "Reply-To: $email\r\n";
if ($bcc != '') $headpart .= "Bcc: $bcc\r\n";
$headpart .= "X-Mailer: HiQ FormMail Version $this_version\r\n";
$headpart .= "Content-Type: multipart/mixed;\r\n\tboundary=\"$boundary\"\r\n";

$msgpart = "This is a multi-part message in MIME format.\r\n";
$msgpart .= "\r\n--$boundary\r\n";
$msgpart .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
$msgpart .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msgpart .= "$content\r\n";
for($i = 0; $i < count($attachuser); $i++) {
$msgpart .= "\r\n--$boundary\r\n";
$fname = basename($attachuser[$i]);
$msgpart .= "Content-Type: $attachtype[$i]; \r\n\tname=\"$fname\"\r\n";
$msgpart .= "Content-Transfer-Encoding: base64\r\n";
$msgpart .= "Content-Disposition: attachment; filename=\"$fname\"\r\n\r\n";
$fcontent = fread(fopen($attachtemp[$i], "r"), filesize($attachtemp[$i]));
$fcontent = chunk_split(base64_encode($fcontent));
$msgpart .= "$fcontent\r\n";
}
$msgpart .= "\r\n--$boundary--\r\n";
} else {
$msgpart .= "$content\r\n";
}

if(!mail($recipient, $subject, $msgpart, $headpart)) {
deleteTempFiles();
issueSingleError("An undetermined error occured while attempting to send mail.");
}
deleteTempFiles();
}
?>

________________

Config file:

# This is a HiQ Formmail configuration file - ver 1.0
# The operation of HiQFM.php is controled by the values contained here.
# The form is [directive] value (multiple values are entered 1 per line)

# Multiple values are entered 1 per line.
[recipient] XX@XX
[bcc]

# --NOTE -- To allow any file type set value to 'all' as in...
# [valid_attach_types] all
[valid_attach_types] image,TExt


# Allow only desired file extensions
[valid_attach_extensions] txt,js
[valid_attach_extensions] gif,jpg,pdf,png

# List of file extentions which are not allowed.
# Default list is bat,com,exe,scr,vbs,vbe,js,reg,pcd,inf,plf and pcd
# Add additional here - a comma seperated list
[non_valid_extensions] bat,com,exe,scr,vbs,vbe,js,reg,pcd,inf,plf and pcd

#list of required form fields -- multiple are entered 1 per line as in:
#[required_fields] field1
#[required_fields] field2
[required_fields] docket
[required_fields] email

# To require attachment(s) set to yes
#[require_attach] none

# Banned emails, email addresses of people who are blocked from using the script.
# Ex. *@somedomain.com,user@domain.com,etc@domains.com
[banned] none

#--------------------------------------
# Items below only accept single values.
#--------------------------------------

# Environment report is used to include information about the form user.
# To activate an item change to yes.
[HTTP_HOST] no
[HTTP_REFERER] no
[BROWSER] yes
[REMOTE_ADDR] yes

# The subject of your email
[subject] Form Submission, HiQFM.. and still....

# By default blank fields not sent - to change set to yes.
[send_blank_fields] yes

# Html file to redirect the user to after form is processed.
[redirect] http://XX.XX/form/thankyou.html

# File to be emailed to the form submitter.
[auto_responder] none

# Header/footer files -- wrap output to blend with site design.
[er_header_file] er_header_def.htm
[er_footer_file] er_footer_def.htm
[header_file] header_def.htm
[footer_file] footer_def.htm

# Applies to allowed size for attached files.
[MAX_FILE_SIZE] 1000000

# Items below apply only to Safe Mode operation.
# The directory defined here MUST be in(or under) the same directory as HiQFM.php
# and have world write permissions (CHMOD 777).
[safemode_temp_dir] TEMP_FILES
# For Safe Mode set this to yes.
[safe_mode] no
dayle is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-06-2010, 07:16 PM Re: button to send a copy of form back to sender. Please help?
kids's Avatar
Ultra Talker

Posts: 301
Trades: 0
Read all your post, but don't understand. Create a copy, where is the destination? to owner's email or someone like that?
__________________

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


Please login or register to view this content. Registration is FREE
kids is offline
Reply With Quote
View Public Profile Visit kids's homepage!
 
Old 09-06-2010, 08:45 PM Re: button to send a copy of form back to sender. Please help?
Junior Talker

Posts: 4
Name: Dayle Sheward
Trades: 0
Thanks for your response. Sorry, let me clarify... I currently receive the form, via email... that all works as it should. But, I would also like the user to have the option of receiving a copy via email themselves.

This ideally would be pulled from the email that they enter in the form.

Thanks again for your help.
dayle is offline
Reply With Quote
View Public Profile
 
Old 09-13-2010, 08:49 PM Re: button to send a copy of form back to sender. Please help?
orionoreo's Avatar
Ultra Talker

Posts: 335
Name: Jerry
Trades: 0
just change the mail send out line to:

PHP Code:
if(!mail($recipient$subject$msgpart$headpart) && !mail($email$subject$msgpart$headpart)) { 
but create another header because your first header assigns the sender as from. Just create a second headpart that's from you
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
orionoreo is offline
Reply With Quote
View Public Profile
 
Old 09-14-2010, 06:25 PM Re: button to send a copy of form back to sender. Please help?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,505
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Or concatenate the email adresses into the to header, use a semi colon to seperate them.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-15-2010, 11:32 PM Re: button to send a copy of form back to sender. Please help?
Junior Talker

Posts: 4
Name: Dayle Sheward
Trades: 0
Thank you for the help. I actually used the following snippet... and I finally got it working. It sends a copy of the email to the user... as well as Admin (myself), which is great.
But, there are a couple of issues.... The email received by the user is not getting a exact duplicate of the original i receive. I actually have to manually set the fields they get back: .$_POST['first_name']; etc. I have a lot of fields, so it seems a bit tedious. Is there any way to send them a duplicate of what I get?
Also, the email they get back is a weird email like: xxxxxxxxx@p3nlh137​.shr.prod.p​hx3.secures​erver.n et.
Is there any way to set it as my email address?

Here is my code.

// Send user a copy
if(@$_POST['emailCopy']){//the name of the cc me checkbox

$to=$_POST['email'];//the name of the email input field
$subject='Studio Job Form Receipt';
$message='The following information was submitted'.$_POST['first_name'];//the name of the message input field
$message=$_POST['docket'].' '.$_POST['last_name'].'\n\r'. // concatenate the other values to the message using a period or more usefully

mail($to,$subject,$message);
}

Thanks in advance
dayle is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to button to send a copy of form back to sender. Please help?
 

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.34504 seconds with 12 queries