Existing File Attachment in Email

Hi All,

I need to attach the file which we already included in the record to the email.I will be sending the email based on the status of the form.

Waiting for the response.

Thanks,
Krishna

Hi @kittusai,

are you looking for this:
grafik

Simply attach the file, then use Menu > Email and select the attachment to be sent with your mail… I have used ERPNext v10.1 with a Sales Invoice for the screenshot…

Hi lasalesi,

Actually we are not sending the Email from this Menu tab we are invoking a function based on the workflow status.
We are using the dynamic message format also.
Looking forward for response.

Thanks,
Krishna

Maybe this is helpful for others:

import frappe
import os

def send_email_with_attachment():
    message = """
        <html><body>
            <p>Bild aus /assets als Attachment: ITUC Logo.png</p>
        </body></html>
    """

    # File ist here: /home/frappe/frappe-bench/apps/erpituc/erpituc/public/images/ITUC Logo.png
    img_path1 = os.path.abspath("assets/erpituc/images/ITUC Logo.png")
    with open(img_path1, "rb") as f:
        img_content1 = f.read()

    frappe.sendmail(
        recipients=["you@your-company.de"],
        subject="send_email_with_attachment",
        message=message,
        attachments=[
            {"fname": "ITUC Logo.png", "fcontent": img_content1}, 
        ],
        now=True
    )