Skip to content

Email Notifications

Vahid Hedayati edited this page Nov 1, 2015 · 1 revision

###Thanks to **akiong **

Who in short described my documentation or information provided for email notifications isn't exactly clear.

This wschat plugin relies on grails mail plugin in order to send out notifications.

Your host that is serving the chat application either needs to be an SMTP server that can relay messages directly through the internet or you could use this example as provided by akiong in the issue raised:

grails{
	mail{
		auth: "Container"
		type: "javax.mail.Session"
		username: "[email protected]"
		password: "myPass"
		props = [
				"mail.smtp.host": "smtp.gmail.com",
				"mail.smtp.port": "465",
				"mail.smtp.auth": "true",
				"mail.smtp.starttls.enable": "true",
				"mail.smtp.socketFactory.class": "javax.net.ssl.SSLSocketFactory"
		]
	}
}

So far as the configuration I will try to explain it better and then use this to update the documentation with:

Firstly these work together, they are in short your hard coded fall back values in the case that your running chat application already does not have a user that has logged in and is part of the admin and that admin has had profile configured with an email address provided.

So these work together and I will try to break it up:

//wschat.liveContactEmail='[email protected]' 
//wschat.liveChatUsername='masterv'  // this is the nickname upon them joining a live request
wschat.liveContactName='Mr V'  // this is the person that email title is set to

What does logged in user that is part of the admin group mean ?

This means that when lets say user called 'admin' logged in and the configuration was at that point:

wschat.defaultperm='admin'

Or was hardcoded account to be part of the admin group:

https://github.com/vahidhedayati/grails-wschat-plugin/wiki/Creating-admin-accounts

You could also expand on that and update their profile at the same time and include their email address.

If you added them automatically and set their email then there would not even be a need for the user admin to log in to site to then update their profile and add email.

When looking up to trigger liveChat emails (old or new methods), the process goes like this:

https://github.com/vahidhedayati/grails-wschat-plugin/blob/master/grails-app/services/grails/plugin/wschat/users/WsChatBookingService.groovy#L116-L140

1> Does the config have liveContactEmail & liveChatUsername

If so send that default username configured the message to join live chat - sent to : wschat.liveContactEmail='[email protected]', including their hard coded username and the room in question for them to join. It generates a link with that room and their username to go to.

2> As well as above now checks the system ChatUser table for admin users

Who have the permission 'admin' and also have ChatUserProfile that has an emailAddress configured.

So as well as the hard coded liveContactEmail any other admin members that have the above criteria will also get the email.

So far as password go ? I doubt it since this is who you are sending the email to you won't need their password. Just ensure you have correctly configured the connection out for your gmail account.

mail{
		auth: "Container"
		type: "javax.mail.Session"
		username: "[email protected]"
		password: "your_actual_gmail_password"

So this bit should be your correct details for it to work and has nothing to do with noreply_from_server. This bit : wschat.liveContactEmail='[email protected]' should actually be wschat.liveContactEmail='[email protected]'

Clone this wiki locally