Jump to content


New Members
  • Posts

  • Joined

  • Last visited

jnel's Achievements


Newbie (1/5)



  1. do i need php on my machine to install the phpmailer with the composer? On this moment i do not have it. The instructions sayd you do not need the composer,then you have to manually include the files in you code.Which i did.But when i run it,i just get to nr 4. It do not want to add the address. use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; echo "2"; require('./src/PHPMailer.php'); echo "3"; require('./src/Exception.php'); echo "na require"; $email= new PHPMailer(); echo "4"; $mail->setFrom('darth@empire.com', 'Darth Vader'); echo "5"; $mail->send(); echo "after send";
  2. i tried to use phpmailer,but can not get it to work.If you can posisble give me a small sample with an attachment,i would really appreciate it. I created a folder phpmail and copied the phpmailer.php file in that folder. then created a test script,but i can not get it to work
  3. Good day, i have written code to send mail to email with an pdf attachment.The pdf is receive when it is send to a gmail account,but when it is send to an exchange mail account,it just looks as in the picture.A lot of nonsens. my statement.pdf is in the folder mainfolder/fpdf i have tried various options,but just can not get this to work.Any help is appreciated. this is the code i am using $filename="statement.pdf"; $subject= "Statement"; $recipient = "email1@gmail.com,email2@namibia.com.na"; $email="email@snappy.com"; //documentation for Output method here: http://www.fpdf.org/en/doc/output.htm $attach_pdf_multipart = chunk_split( base64_encode( $pdf->Output( $filename, 'S' ) ) ); //define the receiver of the email $to = "email1@gmail.com,email2@namibia.com.na"; //define the subject of the email $subject = 'Statement'; //create a boundary string. It must be unique //so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); //define the headers we want passed. Note that they are separated with \r\n $headers = "From: email@snappy.com\r\nReply-To: email@snappy.com"; //add boundary string and mime type specification $headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\""; $headers .= "\r\n"; $msg .= "Content-Type: application/octet-stream; name=\"statement.pdf\"\r\n"; $msg .= "\r\n"; $msg .= "Content-Transfer-Encoding: base64\r\n"; $msg .= "Content-Disposition: attachment\r\n"; $msg .= $attach_pdf_multipart . "\r\n"; $msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n"; $msg .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $msg .= "<p>This is text message from shohag</p>\r\n\r\n"; global $message; $message = ''; $mail_sent = @mail( $to, $subject, $msg, $headers ); //@mail( $to1, $subject, $msg, $headers ); if(!empty($mail_sent)): echo "Mail Has Been Send"; $message = "Statement sent succuessfully"; else: echo "bad-----"; $message = "Error occured. Please try again."; endif;
  • 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.