Send note file with email as attachment

Hi,

In case record i have an note record with file attachment under "Notes" subpanel.

I need to send that file from note record with email as attachment.

Currently the email is sending using ($mail = new SugarPHPMailer();) but how to attach that file with email? I tried to follow php example from this (https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_8.0/Cookbook/Adding_an_Existing_Note_to… ) but its not working

Any help will be highly appreciable 

  • Hi,

    I achieved this by using below logic

    1. Get the note record id and email_id "$emailObj = new Email(); $emailObj->id"

    2. Fetch the document from note record

    3. In upload folder, create duplicate of that document as separate file with extension (i-e: <file_id>.jpg)

    4. Using mail function attach newly created file with email

    Now in cases record view the email with attachment is showing under subpanel of Emails

    Regards