Categories > TBS free chat >

Merged file attach to email

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Janos
Date: 2016-09-13
Time: 20:29

Merged file attach to email

Hi!
I use PHP mailer, but I can't attach the merged docx document to email.
Can somebody help me?

    require_once('PHPMailer-master/PHPMailer-master/class.phpmailer.php');
   
    $email = new PHPMailer();
            $email->From      = 'you@example.com';
            $email->FromName  = 'Your Name';
            $email->Subject   = 'Message Subject';
            $email->Body      = 'najklnsdklsa';
            $email->AddAddress( 'janos.dupai@gmail.com' );

           
$TBS->Show(OPENTBS_STRING);
$docx_content = $TBS->Source;
$file_to_attach = $docx_content;           
           
            $email->AddAttachment( $file_to_attach , 'NameOfFile.docx' );

            return $email->Send();
By: Skrol29
Date: 2016-09-13
Time: 20:44

Re: Merged file attach to email

Hi,

It's a PHPMailer problem.

$email->AddAttachment() is for attaching an existing file on the server.
$email->addStringAttachment() id for attaching a virtual file from binary string.

See https://github.com/PHPMailer/PHPMailer/wiki/Tutorial#string-attachments
By: Janos
Date: 2016-09-13
Time: 20:54

Re: Merged file attach to email

Thanks,

now it attached a docx document, but that is empty.

How can I get the merged documents?
By: Skrol29
Date: 2016-09-15
Time: 17:24

Re: Merged file attach to email

Can you post your snippet ?