How to get email when material request is submitted

Hi,

How can I get a notification with a document ID like a material request number in the user’s email when a material request is submitted?

Either you can write a server script to send email when a document is created or submitted or can use the notification doctype to configure your notifications. Refer the link below.

https://docs.erpnext.com/docs/user/manual/en/notifications

Thanks for your reply.
Could you please explain the steps and how can I do that as I am new to ERPNext?

Thanks

This just an example. For your use case I think you can use the notification doctype where you can set notification for any doctype events . Refer the link I mentioned above.

def send_email_notification(docname):

	doc = frappe.get_doc('Leave Request', docname)
	subject = f"New {doc.request_type} Request From {doc.name1}"
	message = f"A new leave request has been submitted by {doc.name1}.\n"
	message += f"Link to Leave Request: {frappe.utils.get_url_to_form('Leave Request', docname)}"

	frappe.sendmail(
		recipients=['test@gmail.com'],
		subject = subject,
		message = message
	)

If you want to send email via notification doctype,Go to Notification

1.Name your notification
2.Select channel as Email
3. Add subject of your email in subject field.
4. Select document type in your case material request.
5. Select sender as your default sender email account.
6. Add your recipients.
7. Write the message you want to send.

Please note that you should add an email account before setting up email notifications.

https://docs.erpnext.com/docs/user/manual/en/email-account