Sending attached files in php

Status
Not open for further replies.

andreyknure

New member
Aug 12, 2008
85
1
0
Could you please help realize the procedure of sending attached files in php. If it is possible, please, provide me with ready code examples. Thanks in advance!
 


The Open Source PHP Mailer makes this pretty easy:
Codeworx Technologies

Code:
    // instantiate the class
    $mailer = new PHPMailer();;
    
    $mailer->From = "ex@ample.com";
    $mailer->FromName = "Test";
    
    $mailer->AddAttachment($_SERVER['DOCUMENT_ROOT']."/path/example.pdf", 'example.pdf');   
    
    $mailer->Subject = "Your PDF";
    $mailer->Body = 'Well done';

    $mailer->AddAddress('recipient@example.com', '');

    $mailer->Send();
    $mailer->ClearAddresses();
    $mailer->ClearAttachments();
 
Status
Not open for further replies.