Kevin Pirnie' Articles
- Home / Kevin Pirnie’s Articles / email sending
By: Kevin On: December 30, 2012
Posted In: Development PHP Software Source Code development email email sending php web development
The following code will allow you to send an email, with a file attachment without the need for a 3rd party library. This code assumes that you already have the upload and form fully operational. function XMail( $from, $fromname, $to, $subj, $text, $filename) { //Open our file, rb = windows machine, you may need to change this to r for linux $f = fopen($filename,"rb"); //let's get a uniqueidentifier $un = strtoupper(uniqid(time())); //Set the from name and address $head = "From: $fromname <$from>n"; //set who we are sending this to $head .= "To: $ton"; //set the subject $head .= "Subject: $subjn"; //just for s's and giggles $head .= "X-Mailer: PHPMail Tooln"; //set the reply to address $head .= "Reply-To: $fromn"; //now we set our mime types,… Read More