You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Email Function attachment not working

Received Response
6
Views
2
Comments
edited Jun 7, 2022 1:00PM in General Technical Discussions 2 comments

Content

Dear All,

Please help me

I'm trying to generate one .pdf file and send mail to user, i sending mail correctly, but attached .pdf not opening due to content type issue. Error: "file damaged or decoded issue".

Below is my code:

try 
        {
            $email = new RNCPHP\Email();
            $email->Address = $email_1;
            $email->AddressType->ID = 0;
            $email->content_type
            $mm = new RNCPHP\MailMessage();
            $mm->To->EmailAddresses = array($from);
            $mm->Subject = "Test from RNCX";
            $mm->Body->Text = $text_body;
            $mm->Body->Html = $message;
            //$mm->Headers[] = "Content-Type: application/x-www-form-urlencoded";
                

                $fattach = new RNCPHP\FileAttachment();
                $fattach->ContentType ="application/pdf";  
                $fp = $fattach->makeFile();
                fwrite( $fp, "Making some notes in this text file for the Contact".date("Y-m-d h:i:s"));

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!