Header Ads

Send Email Through Adempiere

Send Email Through Adempiere

  1. E-Mail Configuration in Adempiere

Mail Server
  • This will specify the mail server to use
  • Default: mailserver.(domain portion of %{serverFQDN})
  • Example: smtp.gmail.com

Admin Email

  • Use the default administrative mail address and it can be overwritten on client level
  • Default: adempiere@(domain portion of %{ serverFQDN})
  • Example: teksalahadempiere@gmail.com

Mail User

  • Here we specify user of the default mail account
  • Default: adempiere
  • Example: teksalahadempiere

Mail Password

  • The password of the default mail account
  • Default: adempiere
  • Example: **********

1    2.   Configuring Email in the client window
  • The Client Definition Tab defines a unique client
  • Step 1.Login as admin
  • Step 2. Go to Menu -> System Admin -> Client Rules -> Client. In tab client fill fields’ mail host, request email request user and request user password. Finally press Test Email Button

Step 3. Go to Menu -> System Admin -> General Rules -> Security -> User. In tab User Contact fill fields EMail Address, EMail user id and EMailuser password.

Code to send email

Package: org.compiere.model
Class: MClient
public boolean sendEMail (int AD_User_ID, String subject, String message, File attachment)

                        Collection<File> attachments = new ArrayList<File>();
                        if (attachment != null)
                        return sendEMailAttachments(AD_User_ID, subject, message, attachments);

Here the parameters are,

            AD_User_ID : Recipient’s User _ID
            Subject: Subject of the email
            Message: Content in the email
            Attachment: To attach file.
And return true, if the mail is send to the specified user

Powered by Blogger.