You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm wondering if it is possible to use a STARTTLS-enabled SMTP server for email notifications.
We're planning to deploy the ticket service so it's getting increasingly important
to have email notifications for things like new tickets, new comments or new commits
in tickets.
Now I'm trying to use the SMTP server of Office 365 which requires the client to use
STARTTLS (like GMail), and I couldn't get it to work. With smtps enabled, it says:
javax.mail.MessagingException: Could not connect to SMTP host: pod51013.outlook.com,
port: 587;
nested exception is: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
connection?
Without smtps it says:
javax.mail.AuthenticationFailedException: No authentication mechansims supported by
both server and client
Am I missing something or is it currently an unsupported scenario? Thanks in advance,
Viktor
Reported by sundayfunday1234@outlook.com on 2014-04-30 11:35:56
Unfortunately Office 365 doesn't support port 465. Details:
http://office.microsoft.com/en-us/outlook-help/settings-for-pop-and-imap-access-for-office-365-for-business-or-microsoft-exchange-accounts-HA102908389.aspx
Reported by sundayfunday1234@outlook.com on 2014-04-30 13:06:11
I updated the javax.mail dependency to the current release. It may have fixes for starttls
- or it may not. This change has been pushed to develop, if you care to try it.
Sure. I'm reading the build docs ATM:
https://github.com/gitblit/gitblit/blob/develop/README.markdown#building-gitblit
So can it work without Eclipse, too?
Reported by sundayfunday1234@outlook.com on 2014-05-06 11:40:56
When I import the project into Eclipse the Build (All) options are greyed out.
Also, when I try to run Ant from the command line with
ant build.xml
it downloads the moxie toolkit, then it says
BUILD FAILED
Target "build.xml" does not exist in the project "gitblit".
Reported by sundayfunday1234@outlook.com on 2014-05-08 11:09:28
Here's an example Tomcat mail.properties which we're using on several sites:
mail.transport.protocol=smtp
mail.smtp.host=podXXXXX.outlook.com (this is an alternative to smtp.office365.com and
yes, i've tried this with gitblit, too)
mail.smtp.port=587
mail.smtp.starttls.enable=true
mail.smtp.user=noreply@foobar.net
mail.smtp.connectiontimeout=60000
mail.smtp.timeout=60000
mail.smtp.auth=true
#mail.smtp.ehlo=true
mail.debug=false
x-default-recipient-email=john.smith@foobar.net
x-sender-email=support@blah.com (this is a different user that noreply's been granted
to send on behalf)
x-sender-password=***
x-sender-name=Blah Support
Reported by sundayfunday1234@outlook.com on 2014-05-08 16:43:57
Gitblit does not set:
mail.transport.protocol=smtp
mail.smtp.user=noreply@foobar.net
mail.smtp.connectiontimeout=60000
mail.smtp.timeout=60000
I think you are going to have to run this in the debugger to see why it's failing with
your smtp config and where an adjustment needs to be made. There is a unit test for
debugging the MailService.
1. Copy your gitblit.properties file to the root of your gitblit worktree and name
it "mailtest.properties".
2. Make sure you set mail.adminAddresses OR modify the test to hardcode an address.
3. In Eclipse, navigate to src/tests/java/com/gitblit/tests/MailTest.java
4. Right-click in the editor and Run As->JUnit test.
Here's the console:
2014-05-08 19:07:34 [INFO ] send: Test
2014-05-08 19:07:39 [ERROR] Failed to send message
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.1 Client was not authenticated
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1829)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1368)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:886)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send(Transport.java:120)
at com.gitblit.service.MailService.run(MailService.java:273)
at com.gitblit.tests.MailTest.testSendMail(MailTest.java:39)
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:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Reported by sundayfunday1234@outlook.com on 2014-05-08 17:09:46
Also, on the left there's a "Failure Trace". Here's that:
java.lang.AssertionError: mail queue is not empty!
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at com.gitblit.tests.MailTest.testSendMail(MailTest.java:41)
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:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
There are also 5 errors under the "Problems" tab (all of them being "Invalid character
constant" in various java files).
Reported by sundayfunday1234@outlook.com on 2014-05-08 17:12:31
The encoding problem is due to Eclipse's idiotic defaults on Windows.
1. Right-click on the gitblit project and choose Properties (last menu item).
2. First item (Resource): Set "Text file encoding" to UTF-8 and you might as well set
the line delimeter to Unix.
Once you do that the encoding failures should not re-occur. The authentication failure
is something you are going to have to dig into by setting breakpoints in MailService.run().
I can't debug this for you through email or GoogleCode. If you are not comfortable
with that, then I don't know what to tell you. Create a GMail account?
James, thanks for all the guidance. The good news is that I could finally get it to
work, easier than I hoped. All it takes is just this:
props.setProperty("mail.smtp.starttls.enable", "true");
So now we could create a new check similar to isGmail, like isOffice365 with some URL
matching and set this property there, but I wouldn't like it particularly because of
the SMTP server aliases on Office 365. Not to mention that AFAIK all self-hosted, on-premises
Exchange servers require STARTTLS *without* SMTPS, too.
So I propose to go the more robust/flexible way and create a new option in gitblit.properties
like mail.starttls.
final boolean starttls = settings.getBoolean(Keys.mail.starttls, false);
props.setProperty("mail.smtp.starttls.enable", String.valueOf(starttls));
What do you think?
Reported by sundayfunday1234@outlook.com on 2014-05-08 18:01:16
Activity
gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-04-30 11:54:14gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-04-30 13:06:11gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-05-05 15:23:14gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-05-06 10:23:50gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-05-06 11:32:49gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-05-06 11:40:56gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-05-06 11:46:34gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-05-08 11:09:28gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-05-08 12:16:15gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-05-08 12:17:335 remaining items
gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-05-08 16:39:02gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-05-08 16:43:57gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-05-08 17:02:26gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-05-08 17:09:46gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-05-08 17:12:31gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-05-08 17:20:25gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-05-08 18:01:16gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-05-08 18:51:50gitblit commentedon Aug 12, 2015
Reported by
sundayfunday1234@outlook.comon 2014-05-08 19:19:45gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-05-08 19:28:39Queuedgitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-06-17 00:24:34Doneeduardomb08 commentedon May 3, 2016
Could you please add the encoding solution mentioned above in the build section from the main page?
Below you find the referred solution instructions:
the line delimeter to Unix.
Thanks in advance.
Regards,
Eduardo Monteiro de Barros