Link to home
Start Free TrialLog in
Avatar of rivkamak
rivkamakFlag for United States of America

asked on

mail php attachment problem

I am trying to set up my script to send the content of a contact form via php mail.
When I add to attach the file attachment in the header of the email, then my message dissapears.
Any idea how I can work around this problem?
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

If I understand your design concept, the client is expected to fill in a contact form and upload a file.  Is that right?
ASKER CERTIFIED SOLUTION
Avatar of Nrupendra Nath Panigrahi
Nrupendra Nath Panigrahi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rivkamak

ASKER

Your script worked, and I have now discovered that somehow it has to do with my message content that isn't coming through.
If the $message  = "test";
then it comes through in the email.
When I switch the message to look like this, then no data comes through.
$message .= "Following is an application submitted\n\n";
    $message .= "Charity Name: ".($_POST['charityName'])."\n";
    $message .= "charity Website: ".($_POST['charityWebsite'])."\n";
    $message .= "contact Phone: ".($_POST['contactPhone'])."\n";
    $message .= "Email: ".($_POST['Email'])."\n";
    $message .= "Address: ".($_POST['Address'])."\n";
	    $message .= "Mission: ".($_POST['Mission'])."\n";
    $message .= "Taxid Number: ".($_POST['TaxidNumber'])."\n";
		$message .= "\n\nSubmitted on ".date("F j, Y, g:i a");

Open in new window

Why not try printing the message to the browser window, so you can see what it contains?
the problem in my message above is the line that pulls the email. although I am not sure why.
If I take the post['email'] out , then I get the text.

#2, why do I get the attachement as a .dat file that doesn't open.
how can I just get the attachement as it is?
Something does not make sense here.  The original PHP script does not match the script fragment that contains information about charities.  Please, let's reorganize this question and its code snippets, so we can copy your code, install it on our own servers, and run it to see what it is doing.  We need you to create the SSCCE and post it here for us, thanks.
i changed the message to match the fields that I will need in the form.
So I realized that my file upload box has a different  name. I fixed that and now the upload works correctly. But again, the message isn't coming through.

	$message = "Following is an application submitted\n\n";
	  $message .= "message: ". strip_tags($_POST['message'])."\n";
	
  $message .= "Charity Name: ". strip_tags($_POST['charityName'])."\n";
  $message .= "Charity Name: ". strip_tags($_POST['charityName'])."\n";
    $message .= "charity Website: ". strip_tags($_POST['charityWebsite'])."\n";
   $message .= "contact Phone: ". strip_tags($_POST['contactPhone'])."\n";
//   $message .= "Email: ". strip_tags($_POST['Email'])."\n";
  $message .= "Address: ". strip_tags($_POST['Address'])."\n";
  $message .= "Mission: ". strip_tags($_POST['Mission'])."\n";
    $message .= "Taxid Number: ". strip_tags($_POST['TaxidNumber'])."\n";

Open in new window

Why not try printing the message to the browser window, so you can see what it contains?
If you do that, please post the message here so we can see what it contains, too.  You will need to use "view source" to copy the message -- the browser display will not be byte-by-byte accurate because of the way browsers render things like entities and whitespace.