• Email Notifications -

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #22396  by openjob
 
Hi all,

I am trying to configure email notifications in OpenKM 6.2.3 Community. We are using MS Exchange Server. Below is the relevant section that I modified in ".../tomcat/conf/server.xml":
Code: Select all
    <Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
            mail.transport.protocol="smtp"
            mail.smtp.host="smtphost.xxx.com"
            mail.smtp.auth="true"
            mail.smtp.port="25"
            mail.smtp.from="admin123@xxx.com"
            mail.smtp.user="admin123"
            password="adminPassword"
            mail.debug="true"
            />
Now, I have two users in OpenKM as described below:

(1) "okmAdmin" (role_admin) which is given an email address "admin123@xxx.com" (i.e. the one specified in server.xml above)
(2) "myuser1" (role_user) which is given an email address "myuser1@xxx.com"

If I log in as "okmAdmin" and upload files, I can successfully send notication emails.

However, if I log in as "myuser1" and upload files, I fail to send notication emails. When I look into logs/catalina.out, I find the following error message:
Code: Select all
"Client does not have permissions to send as this sender"
I guess that this error is caused by the mismatch between the email account details specified in server.xml and the email address given to user "myuser1". How should I configure server.xml so that every user can set email notifications?

Ideally, I would like to have every users able to send email notifications but with "From" address equal to "admin123@xxx.com" - is this possible?

Look forward to hearing any suggestion and sharing experience. Thank you!
 #22443  by pavila
 
I can guess that error is generated by de mail server:
Code: Select all
Client does not have permissions to send as this sender
This is a Tomcat / Mail Server configuration problem and not related to OpenKM, so you should contact your Mail Server administration and ask for a solution.
 #22465  by jllort
 
Is a mail server problem. Your mail server responses that is not allowed to send to that user. Understand that this account is used to send all user notifications but if you can sent to someones and not other is for some mail server configuration problem ( limitation, restriction, etc... )
 #22469  by openjob
 
Thanks. The problem is resolved now. It was caused by my mail server which by default does not allow users to send email with "From" field set to other user name, i.e. "myuser1" cannot send email by setting "From" field to "admin123". Now, I asked our system administrator to change the email configuration of "admin123" so that other users can send email using it in the "From" field ... then everything works just fine!
 #23182  by balji1989
 
Hi,
I have modified ".../conf/server.xml" file for sending email from OpenKM 6.2.2 Community. Following are the changes i have done,
Code: Select all
<Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
 mail.transport.protocol="smtp"
 mail.smtp.host="smtp.gmail.com"
 mail.smtp.auth="true"
 mail.smtp.port="465"
 mail.smtp.from="username@gmail.com"
 mail.smtp.user="username"  
 password="**********"
 mail.debug="true"
 />
Following is the server log
Code: Select all
ERROR com.openkm.servlet.frontend.FileUploadServlet - MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
java.io.IOException: MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
Please help me out where i am doing wrong.
 #23192  by balji1989
 
Finally i solved my problem. Following is the code i have used for sending notification mail from OpenKM:
Code: Select all
<Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
 mail.transport.protocol="smtp"
 mail.smtp.auth="true"
 mail.smtp.host="smtp.gmail.com"
 mail.smtp.port="465"
 mail.smtp.user="username@gmail.com" 
 password="***********"
 mail.smtp.from="username1@gmail.com"
 mail.smtp.quitwait="false"
 mail.smtp.starttls.enable="true"
 mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
 mail.debug="true"/>
Reference Link : http://wiki.openkm.com/index.php/Tomcat ... figuration
 #23256  by balji1989
 
I have modified email body template in config-->notification.message.body, i can able to add userId in template. Instead i need to add User Name in notification message.
For example, following is an template which i have currently.

<p>Dear All</p>
<p><b>Message: </b>${notificationMessage}</p>
<p>Click here to view content/Doc
<a href="${documentUrl}">${documentPath}</a>
</p>
<br/>
<b>Regards<br/>
${userId}
</b>


Sample output of above template
Dear all,

click here to view the content/doc ABCD.pdf

Regards
user@somedomain.com

${userId}=user@somedomain.com
Instead it should display name of the user that we given during user creation, how to do that? Anyone help me out please
 #23309  by balji1989
 
Hi,
I have solved by modifying CommonNotificationModule.java, in which i have added following line in sendNotification method

model.put("userName", OKMAuth.getInstance().getName(null, user));

In Configuration Page i have mentioned e-mail body format, following is an format of my email and sample output

<p>Dear All</p>
<p><b>Message: </b>${notificationMessage}</p>
<p>Click here to view content/Doc
<a href="${documentUrl}">${documentPath}</a>
</p>
<br/>
<b>Regards<br/>
${userName}
</b>


Sample Output:

Dear All

Message: Message for notification user

Click here to view content/Doc /okm:root/Projects/ProjectFolder/StepsToCreateProject.pdf

Regards
Balaji R
 #23418  by pavila
 
Would be nice to attach the patch so can be included in the next OpenKM release.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.