Decypher's Profile
Reputation: 2
Apprentice
- Group:
- Active Members
- Active Posts:
- 400 (0.22 per day)
- Joined:
- 28-June 08
- Profile Views:
- 1,481
- Last Active:
Jan 25 2012 11:26 AM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Sending attachment via php mail() with temp file on server
Posted 23 Jan 2012
Ok.
At The Moment my code looks like this:
$filename = $_FILES["file"]["tmp_name"]; $to = 'Matthew.Gray@hotmail.co.uk'; $subject = 'PHP Mail Attachment Test'; $message .= "Content-Type: ".$_FILES["file"]["type"]."; name=\"".$filename."\"\r\n" ."Content-Transfer-Encoding: base64\r\n" ."Content-disposition: attachment;" ."\r\n" .chunk_split(base64_encode(file_get_contents($filename))) .$bound_last; if(mail($to, $subject, $message, $from)) { echo 'MAIL SENT SUCCESSFULLY'; } else { echo 'MAIL SENDING FAILED'; }
Now finding tutorials on this shows this should work. BUT! instead of being sent as the actual file it's being sent in it's chunk_splitbase64_encode form inside the email itself.
Unsure How to convert this back to the actual document itself since all the tutorials say this method should work -
In Topic: Sending attachment via php mail() with temp file on server
Posted 17 Jan 2012
Anyone got any ideas? -
In Topic: Sending attachment via php mail() with temp file on server
Posted 12 Jan 2012
Hey CT,
I've had a look into this, the code you've put just displays another set of random chars. -
In Topic: Sending attachment via php mail() with temp file on server
Posted 10 Jan 2012
Hey CT
Thanks for your help so far!
Took your advice and after taking it apart the header section was causing problems. As soon as I deleted this from the mail function (and the header content section) it worked.
However, I now get an email with the message content and then the "file" comes in random characters, I believe 72chars per each lines, which I believe is down to:
.chunk_split(base64_encode($file));
If that's the case how do I make it so instead of the random set of chars, the actual file is sent as an attachment?
Thanks -
In Topic: Sending attachment via php mail() with temp file on server
Posted 9 Jan 2012
I echo'd what you said and it came out as: application/vnd.openxmlformats-officedocument.wordprocessingml.document
which would be right since it was a docx file...
It keeps just going to Mail Failed meaning something is wrong with the mail section of the code but not sure what exactly
My Information
- Member Title:
- D.I.C Regular
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
Decypher has no profile comments yet. Why not say hello?