Send Email immeditly without press on send now

Send Email immeditly without press on send now

Refer this,

Thank you for replying.

I have created a notification system that sends an email when the status is “new”. The email is sent to these participants with the content “There is a new case”. For example, when I create a new car, the emails go to the email queue without being sent immediately. The email is sent when I press this button. I want to be able to send an email directly. I hope my idea is clear.

Hi @Mariam_Mahdi:

Notification uses mail queue to sending out messages.
Create a server script for your Doctype instead, in my case “Customer”.

This way:

Code:

frappe.sendmail(
    recipients="recipient@mail.com", 
    sender="sender@mail.com", 
    subject="New customer created", 
    message=f"Hey, {doc.name} was created.", 
    delayed=False)

It will send an email just after creation, without enqueueing.
Hope this helps.

1 Like

Thank you , it solved