Send Email melalui Automation Script

Masih tentang kenangan akan IBM Maximo, saya pernah mendapat request untuk custom di aplikasi Service Request agar dapat mengirim email reminder approval request. User cukup klik button dan secara otomatis email terkirim (CUKUP BOS? hehe). Setelah googling dan liat Java Docs Maximo akhirnya paham, sekarang saatnya saya memindahkan catatan dari blog lama ke blog ini agar tetap teringat.

Menurut Java Docsnya, fungsi email ada di class bawaan Maximo yaitu MXServer. Sebetulnya dapat juga menggunakan bawaan Java yaitu package javax.mail.*. Cuma sangat malas code panjang lebar karena kudu menkonversi dari Java ke Python. Ya kira-kira begini basicnya :

#logika dasar buat send email
from psdi.server import MXServer;
mx = MXServer.getMXServer();
toMany = [];
toSingle = "email0@email.com";
toMany.append("email1@email.com");
toMany.append("email2@email.com");
toMany.append("email3@email.com");
toMany.append("email4@email.com");
from = "email5@email.com";
#send to many
mx.sendEMail(toMany,from,"subject","this is an email body!");
#send to single (overload method sendEMail)
mx.sendEMail(toSingle,from,"subject","this is an email body!",None);

Di Java Docsnya ada banyak overload method sendEMail dan juga dapat ditambahkan cc bcc dsb. Thanks untuk Maximo Java Docs dan googling 😀

NB : Credit to maximoworks dan maximonews.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.