cancel
Showing results for 
Search instead for 
Did you mean: 

sending Email to invited users via gmail

tejaswini
Champ in-the-making
Champ in-the-making
hi there…
   i want to send the mails to the invited users on particular spaces via gmail server.
   i am doing something as
   1) adding following code to the reository.properties

   # Email configuration
mail.host = smtp.gmail.com
mail.port = 465
mail.transport.protocol = smtp
mail.username =xxxx@gmail.com
mail.password=xxxx
mail.smtp.auth = true
mail.smtp.socketFactory.port = 465
mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback = false
mail.smtp.timeout = 25000
mail.smtp.starttls.enable = true
mail.encoding=UTF-8

and

2) to core-services-context.xml
<bean id="mailService" class="org.springframework.mail.javamail.JavaMailSenderImpl">
  <property name="host">
    <value>${mail.host}</value>
  </property>
  <property name="port">
    <value>${mail.port}</value>
  </property>                                          
  <property name="protocol">                           
    <value>${mail.transport.protocol}</value>
  </property>
  <property name="username">
    <value>${mail.username}</value>
  </property>
  <property name="password">
    <value>${mail.password}</value>
  </property>
  <property name="defaultEncoding">
    <value>${mail.encoding}</value>
  </property>
  <property name="javaMailProperties">
    <props>
      <prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
      <prop key="mail.smtp.socketFactory.port">${mail.smtp.socketFactory.port}</prop>
      <prop key="mail.smtp.socketFactory.class">${mail.smtp.socketFactory.class}</prop>
      <prop key="mail.smtp.socketFactory.fallback">${mail.smtp.socketFactory.fallback}</prop>
      <prop key="mail.smtp.timeout">${mail.smtp.timeout}</prop>
    </props>
  </property>
</bean>

after restarting the server whn i invite the user and try to send the mail on the right email address i got on console
ERROR[web.bean.TemplateMailHelperBean] Failed to send the email at xxxx address.
org.springframework.mail.MailSendException details(1)are failed message 1:
javax.mail.MessagingException:IO Exception while sending message;
nested exception is:
     java.io.UnSupportedEncodingException:${mail.encoding} at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:625)…….
and something like that….
do anybody have the solution to this problem????

thanks in advance
8 REPLIES 8

mrogers
Star Contributor
Star Contributor
It looks like the value for ${mail.encoding} has not been set.    

On 3.2 you should be putting your custom settings into alfresco-global.properties.

tejaswini
Champ in-the-making
Champ in-the-making
thanks but i already had done that.
   i tried alot on that setting but no output….so i decide to do in following way…

in repository.properties
mail.host =smtp.net4india.com

mail.port =25
mail.transport.protocol = smtp
mail.username = xxx@raykor.com
mail.password= xxx
mail.smtp.auth = false
mail.smtp.socketFactory.port =
#if not set default will be use
#mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
#mail.smtp.socketFactory.fallback =
#default to true
mail.smtp.timeout = 35000
mail.smtp.starttls.enable = true
mail.encoding=UTF-8

the same is part of alfresco-global.properties and rest with .xml.
now i am getting as
MailServerConnection failed;nested exception is javax.net.ssl.SSLException;Unrecognised SSL message,plain text connection?
caused by:javax.mail.MEssagingException:Exception reading response;nested exception is……
  what to do now????

sselvan
Champ in-the-making
Champ in-the-making
keep the following in your alfresco-shared.properties

#
# Outbound Email Configuration (was port 25  465)
#————-
mail.host=YourMailHostName
#mail.port=25
mail.username=YourUserName
mail.password=YourPassword
mail.encoding=UTF-8
mail.from.default=youremail@gmail.com
#mail.smtp.auth=true

#trying to enable ssl
mail.port=465
mail.protocol=smtps
mail.smtps.starttls.enable=true
mail.smtps.auth=true

It should work!!! Hope it is helpful for you!

tejaswini
Champ in-the-making
Champ in-the-making
thanks…
i change the alfresco shared.properties as
mail.host=smtp.net4india.com
mail.port=25
mail.username=xxx@raykor.com
mail.password=xxx
mail.encoding=UTF-8
mail.from.default=xxx@gmail.com
mail.smtp.auth=false

#trying to enable ssl
mail.port=465
mail.protocol=smtp
mail.smtps.starttls.enable=true
mail.smtps.auth=false

the alfresco-global.properties contain

mail.host =smtp.net4india.com
#202.71.129.119
mail.port =25
mail.transport.protocol = smtp
mail.username =xxx@raykor.com
mail.password= xxx
mail.smtp.auth = true
mail.smtp.socketFactory.port =
#if not set default will be use
#mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
#mail.smtp.socketFactory.fallback =
#default to true
mail.smtp.timeout = 35000
mail.smtp.starttls.enable = true
mail.encoding=UTF-8

the repository.properties have
mail.host = smtp.net4india.com
mail.port =25
mail.transport.protocol = smtp
mail.username = xxx@raykor.com
mail.password= xxx
mail.smtp.auth = true
mail.smtp.socketFactory.port =
mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback = false
mail.smtp.timeout = 35000
mail.smtp.starttls.enable = true
mail.encoding=UTF-8

but whn i try to send mail on invitation to user it again says…
mail server connection Failed nested exception…
Unrecognized SSl message,plain text connection?????

sselvan
Champ in-the-making
Champ in-the-making
Again,

1) do your changes only in alfresco-global.properties. You don't have to change it in repository.properties also.
2) Can you just have my changes and try it? You seem to have both ports on.

you seem to have mail.smtps.auth false. In mine, I have it as true. Like that, please just use mine and see if it works.

tejaswini
Champ in-the-making
Champ in-the-making
thnks…
   now i can able to send the mail.ya u r right we just need to change the global properties file and thats it.
  thanks good day!!
  do u have any information regarding how to create data tables and how to manage the data?

sselvan
Champ in-the-making
Champ in-the-making
thnks…
now i can able to send the mail.ya u r right we just need to change the global properties file and thats it.
thanks good day!!

That is good. Glad to help and I am happy that it worked!!

do u have any information regarding how to create data tables and how to manage the data?
Could you please explain more about your requirement. This is not clear.

chetna
Champ in-the-making
Champ in-the-making
hey, can u plzzz tell each and every step to fix that prob as me facing same problem.
thanks in advance
chetna