← Back to team overview

dhis2-devs team mailing list archive

Re: Setting up Email

 

Ok, so is this happening when you are sending out the test email?

--
Morten

On Mon, Dec 28, 2015 at 12:40 PM, Pamod Amarakoon <pamodm@xxxxxxxxx> wrote:

> and yes, it's the new settings app I used
>
> On Mon, Dec 28, 2015 at 5:10 PM, Pamod Amarakoon <pamodm@xxxxxxxxx> wrote:
>
>> Dear Morten,
>>
>> I toggled between the remaining ports 25 and 465. Both throws out
>>
>> "Caused by: javax.mail.MessagingException: Could not connect to SMTP
>> host: smtp.gmail.com, port: 2;
>>   nested exception is:
>>         java.net.SocketTimeoutException: connect timed out
>> "
>> I'll try the method you suggested.
>>
>> On Mon, Dec 28, 2015 at 5:07 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
>> wrote:
>>
>>> While not ideal, you could null it out with:
>>> delete from systemsetting where name='keyEmailPort';
>>>
>>> And then it should default to TLS port.
>>>
>>> --
>>> Morten
>>>
>>> On Mon, Dec 28, 2015 at 12:35 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx
>>> > wrote:
>>>
>>>> Right. That's what i suspected, that setting is wrong. Did you use the
>>>> new setting app to set it? could you try and change between the different
>>>> ports and see if the output changes for you?
>>>>
>>>> It could be a bug in the settings app, but I'm not sure. 0 is never a
>>>> valid value for that setting.
>>>>
>>>> --
>>>> Morten
>>>>
>>>> On Mon, Dec 28, 2015 at 12:33 PM, Pamod Amarakoon <pamodm@xxxxxxxxx>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> It's "0"
>>>>>
>>>>> On Mon, Dec 28, 2015 at 5:00 PM, Morten Olav Hansen <
>>>>> mortenoh@xxxxxxxxx> wrote:
>>>>>
>>>>>> Could you give me the output of:
>>>>>>
>>>>>> SERVER/api/systemSettings/keyEmailPort
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Morten
>>>>>>
>>>>>> On Mon, Dec 28, 2015 at 12:20 PM, Pamod Amarakoon <pamodm@xxxxxxxxx>
>>>>>> wrote:
>>>>>>
>>>>>>> Thanx Morten,
>>>>>>>
>>>>>>> it's
>>>>>>> Version:2.21Build revision:20850Build date:2015-10-26 01:19
>>>>>>>
>>>>>>> On Mon, Dec 28, 2015 at 4:48 PM, Morten Olav Hansen <
>>>>>>> mortenoh@xxxxxxxxx> wrote:
>>>>>>>
>>>>>>>> Ok
>>>>>>>>
>>>>>>>> What version of DHIS 2? I'm adding in Lars, I think he has set it
>>>>>>>> up for gmail before (I haven't).
>>>>>>>>
>>>>>>>> --
>>>>>>>> Morten
>>>>>>>>
>>>>>>>> On Mon, Dec 28, 2015 at 11:54 AM, Pamod Amarakoon <pamodm@xxxxxxxxx
>>>>>>>> > wrote:
>>>>>>>>
>>>>>>>>> Thanx Morten. By bad, wrong port.
>>>>>>>>>
>>>>>>>>> But when I selected port 587, it throws out following error.
>>>>>>>>>
>>>>>>>>> * WARN  2015-12-28 16:22:00,067 Error while sending email: Cannot
>>>>>>>>> connect to a port number that is less than 1 ( 0 ),
>>>>>>>>> java.lang.IllegalArgumentException: Cannot connect to a port number that is
>>>>>>>>> less than 1 ( 0 )
>>>>>>>>>         at
>>>>>>>>> org.apache.commons.mail.Email.setSmtpPort(Email.java:533)
>>>>>>>>>         at
>>>>>>>>> org.hisp.dhis.message.EmailMessageSender.getHtmlEmail(EmailMessageSender.java:176)
>>>>>>>>>         at
>>>>>>>>> org.hisp.dhis.message.EmailMessageSender.sendMessage(EmailMessageSender.java:127)
>>>>>>>>>         at sun.reflect.GeneratedMethodAccessor631.invoke(Unknown
>>>>>>>>> Source)
>>>>>>>>>         at
>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>>>>>         at java.lang.reflect.Method.invoke(Method.java:497)
>>>>>>>>>         at
>>>>>>>>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>>>>>>>>>         at
>>>>>>>>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
>>>>>>>>>         at
>>>>>>>>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
>>>>>>>>>         at
>>>>>>>>> org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:110)
>>>>>>>>>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>>>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>>>>>  (EmailMessageSender.java [SimpleAsyncTaskExecutor-24])
>>>>>>>>>
>>>>>>>>> On Mon, Dec 28, 2015 at 4:18 PM, Morten Olav Hansen <
>>>>>>>>> mortenoh@xxxxxxxxx> wrote:
>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> Could it be that its the wrong port? it seems like TLS requires
>>>>>>>>>> port 587 [1] ?
>>>>>>>>>>
>>>>>>>>>> [1]
>>>>>>>>>> http://email.about.com/od/accessinggmail/f/Gmail_SMTP_Settings.htm
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Morten
>>>>>>>>>>
>>>>>>>>>> On Mon, Dec 28, 2015 at 11:44 AM, Pamod Amarakoon <
>>>>>>>>>> pamodm@xxxxxxxxx> wrote:
>>>>>>>>>>
>>>>>>>>>>> Dear All,
>>>>>>>>>>>
>>>>>>>>>>> I tried setting up email on an instance with SMTP using Google
>>>>>>>>>>> Apps settings. Following are the settings I used.
>>>>>>>>>>>
>>>>>>>>>>> hostname: smtp.gmail.com
>>>>>>>>>>> port: 465
>>>>>>>>>>> username: xxx@xxxxxxx
>>>>>>>>>>> password: ****
>>>>>>>>>>> Email sender: xxx@xxxxxxx
>>>>>>>>>>> TLS enabled
>>>>>>>>>>>
>>>>>>>>>>> But, testing email is never received at my emaiil account.
>>>>>>>>>>>
>>>>>>>>>>> When I checked catalina.out it contained following errors.
>>>>>>>>>>>
>>>>>>>>>>> * INFO  2015-12-28 16:03:45,413 Sending email to user: XXX with
>>>>>>>>>>> email address: xxx@xxxxxxx to host: smtp.gmail.com:1
>>>>>>>>>>> (EmailMessageSender.java [SimpleAsyncTaskExecutor-15])
>>>>>>>>>>> * WARN  2015-12-28 16:04:45,491 Could not send email: Sending
>>>>>>>>>>> the email to the following server failed : smtp.gmail.com:1,
>>>>>>>>>>> org.apache.commons.mail.EmailException: Sending the email to the following
>>>>>>>>>>> server failed : smtp.gmail.com:1
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.commons.mail.Email.sendMimeMessage(Email.java:1410)
>>>>>>>>>>>         at org.apache.commons.mail.Email.send(Email.java:1437)
>>>>>>>>>>>         at
>>>>>>>>>>> org.hisp.dhis.message.EmailMessageSender.sendMessage(EmailMessageSender.java:150)
>>>>>>>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>>>>>>>> Method)
>>>>>>>>>>>         at
>>>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>>>>>>>>         at
>>>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>>>>>>>         at java.lang.reflect.Method.invoke(Method.java:497)
>>>>>>>>>>>         at
>>>>>>>>>>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>>>>>>>>>>>         at
>>>>>>>>>>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
>>>>>>>>>>>         at
>>>>>>>>>>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
>>>>>>>>>>>         at
>>>>>>>>>>> org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:110)
>>>>>>>>>>>         at
>>>>>>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>>>>>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>>>>>>> Caused by: javax.mail.MessagingException: Could not connect to
>>>>>>>>>>> SMTP host: smtp.gmail.com, port: 1;
>>>>>>>>>>>   nested exception is:
>>>>>>>>>>>         java.net.SocketTimeoutException: connect timed out
>>>>>>>>>>>         at
>>>>>>>>>>> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1972)
>>>>>>>>>>>         at
>>>>>>>>>>> com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
>>>>>>>>>>>         at javax.mail.Service.connect(Service.java:317)
>>>>>>>>>>>         at javax.mail.Service.connect(Service.java:176)
>>>>>>>>>>>         at javax.mail.Service.connect(Service.java:125)
>>>>>>>>>>>         at javax.mail.Transport.send0(Transport.java:194)
>>>>>>>>>>>         at javax.mail.Transport.send(Transport.java:124)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.commons.mail.Email.sendMimeMessage(Email.java:1400)
>>>>>>>>>>>         ... 12 more
>>>>>>>>>>> Caused by: java.net.SocketTimeoutException: connect timed out
>>>>>>>>>>>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>>>>>>>>>>>         at
>>>>>>>>>>> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
>>>>>>>>>>>         at
>>>>>>>>>>> java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
>>>>>>>>>>>         at
>>>>>>>>>>> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
>>>>>>>>>>>         at
>>>>>>>>>>> java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
>>>>>>>>>>>         at java.net.Socket.connect(Socket.java:589)
>>>>>>>>>>>         at
>>>>>>>>>>> com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:317)
>>>>>>>>>>>         at
>>>>>>>>>>> com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:233)
>>>>>>>>>>>         at
>>>>>>>>>>> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1938)
>>>>>>>>>>>         ... 19 more
>>>>>>>>>>>  (EmailMessageSender.java [SimpleAsyncTaskExecutor-15])
>>>>>>>>>>>
>>>>>>>>>>> //////////////////////////////////
>>>>>>>>>>>
>>>>>>>>>>> it contains could not connect to SMTP host and connection timed
>>>>>>>>>>> out. Do I need to set anything else on Tomcat config? What am I missing
>>>>>>>>>>> here.
>>>>>>>>>>>
>>>>>>>>>>> Thank you
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Regards,
>>>>>>>>>>> Pamod Amarakoon
>>>>>>>>>>>
>>>>>>>>>>> Confidentiality Notice: the information contained in this email
>>>>>>>>>>> and any attachments may be legally privileged and confidential. If you are
>>>>>>>>>>> not an intended recipient, you are hereby notified that any dissemination,
>>>>>>>>>>> distribution, or copying of this e-mail is strictly prohibited. If you have
>>>>>>>>>>> received this e-mail in error, please notify the sender and permanently
>>>>>>>>>>> delete the e-mail and any attachments immediately. You should not retain,
>>>>>>>>>>> copy or use this e-mail or any attachments for any purpose, nor disclose
>>>>>>>>>>> all or any part of the contents to any other person.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Regards,
>>>>>>>>> Pamod Amarakoon
>>>>>>>>>
>>>>>>>>> Confidentiality Notice: the information contained in this email
>>>>>>>>> and any attachments may be legally privileged and confidential. If you are
>>>>>>>>> not an intended recipient, you are hereby notified that any dissemination,
>>>>>>>>> distribution, or copying of this e-mail is strictly prohibited. If you have
>>>>>>>>> received this e-mail in error, please notify the sender and permanently
>>>>>>>>> delete the e-mail and any attachments immediately. You should not retain,
>>>>>>>>> copy or use this e-mail or any attachments for any purpose, nor disclose
>>>>>>>>> all or any part of the contents to any other person.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Regards,
>>>>>>> Pamod Amarakoon
>>>>>>>
>>>>>>> Confidentiality Notice: the information contained in this email and
>>>>>>> any attachments may be legally privileged and confidential. If you are not
>>>>>>> an intended recipient, you are hereby notified that any dissemination,
>>>>>>> distribution, or copying of this e-mail is strictly prohibited. If you have
>>>>>>> received this e-mail in error, please notify the sender and permanently
>>>>>>> delete the e-mail and any attachments immediately. You should not retain,
>>>>>>> copy or use this e-mail or any attachments for any purpose, nor disclose
>>>>>>> all or any part of the contents to any other person.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Pamod Amarakoon
>>>>>
>>>>> Confidentiality Notice: the information contained in this email and
>>>>> any attachments may be legally privileged and confidential. If you are not
>>>>> an intended recipient, you are hereby notified that any dissemination,
>>>>> distribution, or copying of this e-mail is strictly prohibited. If you have
>>>>> received this e-mail in error, please notify the sender and permanently
>>>>> delete the e-mail and any attachments immediately. You should not retain,
>>>>> copy or use this e-mail or any attachments for any purpose, nor disclose
>>>>> all or any part of the contents to any other person.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> Regards,
>> Pamod Amarakoon
>>
>> Confidentiality Notice: the information contained in this email and any
>> attachments may be legally privileged and confidential. If you are not an
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this e-mail is strictly prohibited. If you have
>> received this e-mail in error, please notify the sender and permanently
>> delete the e-mail and any attachments immediately. You should not retain,
>> copy or use this e-mail or any attachments for any purpose, nor disclose
>> all or any part of the contents to any other person.
>>
>>
>>
>>
>
>
> --
> Regards,
> Pamod Amarakoon
>
> Confidentiality Notice: the information contained in this email and any
> attachments may be legally privileged and confidential. If you are not an
> intended recipient, you are hereby notified that any dissemination,
> distribution, or copying of this e-mail is strictly prohibited. If you have
> received this e-mail in error, please notify the sender and permanently
> delete the e-mail and any attachments immediately. You should not retain,
> copy or use this e-mail or any attachments for any purpose, nor disclose
> all or any part of the contents to any other person.
>
>
>
>

Follow ups

References