Page 1 of 1

Email Notifications -

PostPosted:Wed Apr 10, 2013 7:53 am
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!

Re: Email Notifications -

PostPosted:Thu Apr 11, 2013 8:09 am
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.

Re: Email Notifications -

PostPosted:Thu Apr 11, 2013 9:39 pm
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... )

Re: Email Notifications -

PostPosted:Fri Apr 12, 2013 4:13 am
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!

Re: Email Notifications -

PostPosted:Fri May 24, 2013 9:04 am
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.

Re: Email Notifications -

PostPosted:Sat May 25, 2013 8:43 am
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

Re: Email Notifications -

PostPosted:Tue May 28, 2013 4:07 pm
by pavila
Thanks for sharing.

Email Notifications-How to add username in e-mail notificati

PostPosted:Thu May 30, 2013 7:05 am
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

Re: Email Notifications -

PostPosted:Tue Jun 04, 2013 4:23 am
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

Re: Email Notifications -

PostPosted:Fri Jun 07, 2013 9:34 am
by pavila
Would be nice to attach the patch so can be included in the next OpenKM release.