Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

upload images

the mail() function

Moderators: macek, egami, gesf

upload images

Postby itsrron » Fri May 04, 2012 7:46 pm

Hey guys, Iv created a form to allow users to sign a sort of membership form whereby they can input relevant details and there is an upload image option.

I have coded file both in HTML and PHP but I'm not sure how to go about adding the PHP code to send the image file to the email as an attachement or something.

here is a copy of the code: (e-mail has been removed)

Code: Select all
<?php
   
/* Subject and Email Variables */

   $emailSubject = 'New Member';
   $webMaster = 'email@address.com';
   
   
   
/* Gathering Data Variables */

   $firstname = $_POST['firstname'];
   $surname = $_POST['Surname'];
   $day = $_POST['DateOfBirth_Day'];
   $month = $_POST['DateOfBirth_Month'];
   $year = $_POST['DateOfBirth_Year'];
   $sex = $_POST['sex'];
   $email = $_POST['email'];
   $profession = $_POST['profession'];
   
   $body = <<<EOD
<br><hr><br>
<strong>First Name:</strong><br> $firstname <br><br>
<strong>Surname:</strong><br> $surname <br><br>
<strong>D.O.B:</strong><br> $day - $month - $year <br><br>
<strong>Sex:</strong><br> $sex <br><br>
<strong>Email:</strong><br> $email <br><br>
<strong>Profession:</strong><br> $profession <br><br>
EOD;

   $headers = "From: $email\r\n";
   $headers .= "Content-type: text/html\r\n";
   $success = mail($webMaster, $emailSubject, $body, $headers);
   
   
/* Results rendered as HTML */

$theResults = <<<EOD
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Message Sent!</title>
<meta http-equiv="refresh" content="5;URL=http://www.hardkase.co.uk/">
<style type="text/css">
   #text { width: 450px; margin: 100px auto 0 auto; }
   body { width: 100%;   height: 100%; background: black;}
   h1, h2 {color: white;}
</style>
</head>

<div id="text">
   <h1>Thank you for your application.</h1>
   <h2>Your request will be dealt with as soon as possible and you will be notified by e-mail once your application has been approved.</h2>
</div>
</body>
</html>
EOD;

echo  $theResults;

?>
User avatar
itsrron
New php-forum User
New php-forum User
 
Posts: 8
Joined: Sat Jan 07, 2012 12:04 pm
Location: London

Re: upload images

Postby macek » Mon May 07, 2012 12:57 am

Hi,

try to use PHPMailer - http://phpmailer.worxware.com/
User avatar
macek
php-forum Active User
php-forum Active User
 
Posts: 277
Joined: Wed Aug 25, 2010 10:42 am


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron