473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP mailer with multi-form support

I am green to PHP and trying to create outside PHP mailer for html form ,i found the script i need but I can't get it to upload more than one file ,since i do not know exactly where to place script request for file2-file10 as well as the exact line to place extension control and size limit ,SOS , any help would be aprishiated

the mailer script:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 ||
  3.          !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))
  4.          die("Bad referer");
  5. $form_fields=array_keys($HTTP_POST_VARS);$temp="Sender's IP Address: ".$_SERVER['REMOTE_ADDR']."\n";while($field = array_pop($form_fields)){$temp.="$field: $HTTP_POST_VARS[$field]\n";}$to=$_POST['To'];$from=$_POST['Email'];$message=$temp;$fileatt=$_FILES['File']['tmp_name'];$fileatt_type=$_FILES['File']['type'];$fileatt_name=$_FILES['File']['name'];$headers="From: $from";if(is_uploaded_file($fileatt)){$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}\"";$message="This is a multi-part message in MIME format.\n\n"."--{$mime_boundary}\n"."Content-Type: text/plain;charset=\"UTF-8\"\n"."Content-Transfer-Encoding: 7bit\n\n".$message."\n\n";$data=chunk_split(base64_encode($data));$message.="--{$mime_boundary}\n"."Content-Type: {$fileatt_type};\n"." name=\"{$fileatt_name}\"\n"."Content-Transfer-Encoding: base64\n\n".$data."\n\n"."--{$mime_boundary}--\n";}
  6.  
  7. $ok=@mail($to,"YOUR COMANY OR NAME Form-Mail Message",$message,$headers);
  8. if(!$ok)header("location:domain goes here");
  9.  
  10. ?>
[Please use CODE tags when posting source code. Thanks! --pbmods]
Apr 8 '07 #1
2 2002
ak1dnar
1,584 Expert 1GB
Next time read the posting guidelines. and wrap the code using CODE tags.
Apr 8 '07 #2
you can download php mailer and here
Jun 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John Davis | last post by:
What is the **MOST** obvious reason why will this will fail (it's not syntax or anything specific to the object)? Function Mail(MailerProgram, Message, Subject, Format, FromEmail, ToEmail,...
5
by: WoG | last post by:
I am having a heck of a problem getting this script to email correctly. A form generates all the values, and the script sends off confirmation email- except I don't get any of the confirmation...
8
by: Dave Smithz | last post by:
Hi, Thanks to this group I discovered the excellent PHP Mailer (http://phpmailer.sourceforge.net/) which I use to send emails. Part of my application emails out hundreds of club members unique...
4
by: Prabhat Nath | last post by:
Hi All, I know that the SMTPsvg.Mailer component is used to send mails from ASP Page. Can any body tell me where can I get the Component for download or Do I need to purchase the component? ...
12
by: Larry | last post by:
I found this basic PHP mailer with file attachment capability. It works just fine, but I want to add a CC: and BCC: to its output. I added the $cc & $bcc variables below, but unsure how to...
10
by: Flopper | last post by:
Hey can anyone help me with a WORKING anonymous mailer php script. I've looked on the net but only find non working one's. Greetings Floppie
4
by: Al G | last post by:
Has anyone played with MS's SMTP sample, mailer.exe? I downloaded the sample, and ran it, but keep getting the error "Failure sending mail". Where might I look for more information? Maybe some...
0
by: askzda | last post by:
Hi, Can somebody pls help to solve above problem. I have used dundas mailer for my mailing part in my asp script, but the an error occured during sending the mail. Error that is prompted out just...
6
by: Dave Kelly | last post by:
Sorry for the long post, it is easier to discard information than to have to wait for it to arrive. So here goes: This code worked perfectly when I was an Earthlink customer. Sprint decided...
9
by: neovantage | last post by:
hey geeks, I have a small mail script which will cause a PHP script to send a receipt upon clicking the submit button, by an HTML mail. This mail contains special characters, namely 'å', 'ä' and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
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...
0
BarryA
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...
1
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...
0
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.