Jump to content

Allowing attachments in an email


niadev

Recommended Posts

I've just created a Contact Us form where users can email me from a website I created:

 

www.greencastleparish.com/contactusbackup.htm.

 

As you can see I have provided users with the option to attach a file to send to me.

 

The problem is that when I test it I can receive the email ok, but there are no attachments.

 

Here's the PHP script:

 

<?php

$formurl = "http://www.greencastleparish.com/contactusbackup.htm" ;
$thankyouurl = "http://www.greencastleparish.com/thankyou.htm" ;

$uself = 0;

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['Name'] ;
$telephone = $_POST['Telephone'] ;
$email = $_POST['Email'] ;
$comments = $_POST['Questions/comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

$subject = "New comment from $name";

$message =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n\n" .
"Name: $name\n" .
"Email: $email\n" .
"Telephone: $telephone\n" .
"------------------------- COMMENTS -----------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

mail("[email protected]", $subject, $message, "FROM: [email protected]" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;
?>

 

Niall

Link to comment
https://forums.phpfreaks.com/topic/93542-allowing-attachments-in-an-email/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.