php mailer with attachment

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
helpplease
Forum Newbie
Posts: 1
Joined: Sat Jan 07, 2012 5:33 pm

php mailer with attachment

Post by helpplease »

Hi im so happy to contact with you and will be very glad to see your help. so i just wrote a code for my html form
here is it ... and it is working fine...

***** PLEASE USE PHP CODE TAG *****

Code: Select all

<?php 
 $to = $_REQUEST['sendto'] ; 
 $from = $_REQUEST['email'] ; 
 $name = $_REQUEST['name'] ; 
 $headers = "From: $from"; 
 $subject = "attention!!!! :)))  Individuum Casting Registration!!!! :))"; 
 
 $fields = array(); 
 $fields{"name"} = "name"; 
 $fields{"email"} = "email"; 
 $fields{"height"} = "height"; 
 $fields{"weight"} = "weight"; 
 $fields{"education"} = "education"; 
 $fields{"DateOfBirth_Month"} = "DateOfBirth_Month"; 
 $fields{"DateOfBirth_Day"} = "DateOfBirth_Day"; 
 $fields{"DateOfBirth_Year"} = "DateOfBirth_Year"; 
 $fields{"country"} = "country";
 $fields{"city_"} = "city_";
 $fields{"home_phone"} = "home_phone";
 $fields{"cell_phone"} = "cell_phone";
 $fields{"Can_You_Drive_A_Car"} = "Can_You_Drive_A_Car";
 $fields{"Do_you_have_any_experiance_in_casting_industry?"} = "Do_you_have_any_experiance_in_casting_industry?";
 $fields{"Movie"} = "Movie"; 
 $fields{"Telenovella"} = "Telenovella"; 
 $fields{"Advertisement"} = "Advertisement"; 
 $fields{"Humorous_Projects"} = "Humorous_Projects"; 
 $fields{"Musical_Projects"} = "Musical_Projects"; 
 $fields{"Dance_Projects"} = "Dance_Projects"; 
 $fields{"Photo_Sessions"} = "Dance_Projects"; 
 $fields{"Episodic_scenes"} = "Episodic_scenes"; 
 $fields{"Underwaear_Scenes"} = "Underwaear_Scenes";
 $fields{"Participate_in_projects_as_a_guest"} = "Participate_in_projects_as_a_guest"; 
 $fields{"Are_you_registered_in_another_Casting_Production?"} = "Are_you_registered_in_another_Casting_Production?";
   
 $body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ 	$body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } 
 
 $headers2 = "From: noreply@individuum.am"; 
 $subject2 = "Thank you for contacting us"; 
 $autoreply = "Thank you for registration . Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at http://www.individuum.am";
 
 if($from == '') {print "You have not entered an email, please go back and try again";} 
 else { 
 if($name == '') {print "You have not entered a name, please go back and try again";} 
 else { 
 $send = mail($to, $subject, $body, $headers); 
 $send2 = mail($from, $subject2, $autoreply, $headers2); 
 if($send) 
 {header( "Location: http://www.individuum.am/thankyou.html" );} 
 else 
 {print "We encountered an error sending your mail, please notify webmaster@individuum.am"; } 
 }
}

 ?>



now i need to write a code for multiple images so user can upload an image and i want to get it on my yahoo mail as a part of form. im sorry i dont speak english well :( need a help
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: php mailer with attachment

Post by Christopher »

So you want the user to:

1. Upload multiple images

2. Attach those images to an email and sent it to you

Start with the manual (they may also have a version in your language).

mail() - http://us.php.net/manual/en/function.mail.php See user comments for attaching an image

uploads - http://us.php.net/manual/en/features.file-upload.php
(#10850)
Post Reply