Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

PHP mail attachment - sending an attachment with PHP

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
12,588
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Mar 3, 2010

sending an email with php is easy, an attachment is a bit harder, but possible. Here are somethings you will need from the video

(note, just SOME of the things)
$content = chunk_split(base64_encode(file_get_contents($file)));
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$file_name."\"\r\n\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";


FAST VIDEO

  • likes, 5 dislikes

Link to this comment:

Share to:

Uploader Comments (optikalefxx)

  • Question, is it possible to send an attachment to someone that can't be forwarded to someone else?

  • @dbmrhi nope sorry

see all

All Comments (93)

Sign In or Sign Up now to post a comment!
  • Fantastic Job........

  • Wasting of my time

    why you did not Attached the source file :(

  • great vid, great tutorial... got it workin on my system thanks to you.

  • THankss man!! 

  • God bless you man!

  • @Szegi87 just do unlink($file) afterwards

  • @optikalefxx is there another way? i mean just send email with attachment without putting it on my hosting server?

  • @Szegi87 Thats because you didn't move the uploaded file to your computer first. You need to use move_file_upload first, then use that location as the file

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more