#Write this code in docttype-name.js life
frappe.ui.form.on('Sales Order', {
send_email: function(frm) {
if ( frm.doc.email ){
frappe.call({
method : "hotel.api.send_conformation_email",
args : {
hotel :frm.doc.name
}
});
}
}
});
#write this code in api.py file in your application ex. hotel
import frappe
from frappe.model.document import Document
@frappe.whitelist()
def send_conformation_email(hotel):
# i use field as hardcoded so please change according to your req.
frappe.sendmail(
recipients="demo@gmail.com",
sender="test@gmail.com",
subject="sub",
message="content",
send_priority = 0
)
frappe.msgprint("send mail success")
frappe.ui.form.on('Sales Order', {
send_email: function(frm) {
if ( frm.doc.email ){
frappe.call({
method : "hotel.api.send_conformation_email",
args : {
hotel :frm.doc.name
}
});
}
}
});
#write this code in api.py file in your application ex. hotel
import frappe
from frappe.model.document import Document
@frappe.whitelist()
def send_conformation_email(hotel):
# i use field as hardcoded so please change according to your req.
frappe.sendmail(
recipients="demo@gmail.com",
sender="test@gmail.com",
subject="sub",
message="content",
send_priority = 0
)
frappe.msgprint("send mail success")
No comments:
Post a Comment