You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@manifoldcf.apache.org by Markus Schuch <ma...@web.de> on 2016/04/13 22:37:58 UTC

E-Mail notifications over SMTP

Hi,

i wanted to try the email notification connector to send emails on job aborts.

But couldn't get it working with our mx server. The email notification connector only offers POP3 or IMAP protocol. In my world these are for receiving emails. For sending i need SMTP. How am I supposed to configure that? (MCF 2.3)

Thanks in advance
Markus

Re: E-Mail notifications over SMTP

Posted by Karl Wright <da...@gmail.com>.
Hi Markus,

I've created a ticket: CONNECTORS-1296, and attached a patch which strips
out all use of the Store concept, since I think that's only of any use
reading mail and never sending.  This means that the protocol specification
in the UI goes away entirely also.

Can you apply the patch and see if this works in your environment?

I'm also interested in whether always saying "use auth" and "use TLS" is
the wrong thing to do, so any idea about that is welcome.

As far as schedule is concerned, we're just getting ready to start the
release process for 2.4, so if we can come up with a working notification
connector before that happens I'd be pleased.

Thanks,
Karl


On Fri, Apr 15, 2016 at 7:43 AM, Markus Schuch <ma...@web.de> wrote:

> Hi Karl,
>
> i had no luck with the java mail properties.
>
> The following error occurs when a mail should be sent after a job
> completion:
>
> 2016-04-15 13:30:51,595 WARN  [Job reset thread]
> org.apache.manifoldcf.connectors: Error notifying: Error connecting: 220
> mx.smtp.***.de ESMTP Postfix (com.sun.mail.iap.ConnectionException: 220
> mx.smtp.***.de ESMTP Postfix)
> org.apache.manifoldcf.core.interfaces.ManifoldCFException: Error
> connecting: 220 mx.smtp.***.de ESMTP Postfix
> (com.sun.mail.iap.ConnectionException: 220 mx.smtp.***.de ESMTP Postfix)
>         at
> org.apache.manifoldcf.crawler.notifications.email.EmailConnector.handleMessagingException(EmailConnector.java:792)
>         at
> org.apache.manifoldcf.crawler.notifications.email.EmailConnector.getSession(EmailConnector.java:194)
>         at
> org.apache.manifoldcf.crawler.notifications.email.EmailConnector.sendMail(EmailConnector.java:317)
>         at
> org.apache.manifoldcf.crawler.notifications.email.EmailConnector.notifyOfJobEnd(EmailConnector.java:270)
>         at
> org.apache.manifoldcf.crawler.system.JobResetThread.doEndNotifications(JobResetThread.java:260)
>         at
> org.apache.manifoldcf.crawler.system.JobResetThread.run(JobResetThread.java:123)
> Caused by: javax.mail.MessagingException: 220 mx.smtp.***.de ESMTP Postfix
> (com.sun.mail.iap.ConnectionException: 220 mx.smtp.***.de ESMTP Postfix)
>         at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:668)
>         at javax.mail.Service.connect(Service.java:251)
>         at
> org.apache.manifoldcf.crawler.notifications.email.EmailSession.<init>(EmailSession.java:57)
>         at
> org.apache.manifoldcf.crawler.notifications.email.EmailConnector$ConnectThread.run(EmailConnector.java:825)
> Caused by: com.sun.mail.iap.ConnectionException: 220 mx.smtp.***.de ESMTP
> Postfix
>         at
> com.sun.mail.imap.protocol.IMAPProtocol.processGreeting(IMAPProtocol.java:239)
>         at com.sun.mail.iap.Protocol.<init>(Protocol.java:120)
>         at
> com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:111)
>         at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:637)
>         ... 3 more
>
> There is obviously still some IMAP stuff happening during the send process.
>
> The configured notification connection as JSON string:
>
>   {"notificationconnection":{"isnew":"false","name":"mail","class_name":"org.apache.manifoldcf.crawler.notifications.email.EmailConnector","max_connections":"10","description":"","configuration":{"_PARAMETER_":[{"_value_":"","_attribute_name":"username"},{"_value_":"","_attribute_name":"password"},{"_value_":"IMAP","_attribute_name":"protocol"},{"_value_":"mx.smtp.***.de","_attribute_name":"server"},{"_value_":"25","_attribute_name":"port"}],"properties":[{"_value_":"","_attribute_name":"protocol","_attribute_value":"smtp"},{"_value_":"","_attribute_name":"type","_attribute_value":"Transport"},{"_value_":"","_attribute_name":"class","_attribute_value":"com.sun.mail.smtp.SMTPTransport"},{"_value_":"","_attribute_name":"vendor","_attribute_value":"Sun
> Microsystems, Inc."}]}}}
>
> Regards,
> Markus
>
> *Gesendet:* Mittwoch, 13. April 2016 um 23:45 Uhr
> *Von:* "Markus Schuch" <ma...@web.de>
> *An:* user@manifoldcf.apache.org
> *Betreff:* Re: E-Mail notifications over SMTP
> Hi Karl,
>
> i will try the Java mail properties you described.
>
> I only concentrated on getting a positive connection working status so
> far. But now i understand this is not possible because the connection check
> would only work for POP3 or IMAP mail hosts. However, sending mails might
> still work with the mentioned properties. I will report back.
>
> Authentication is not an issue for me at the moment because i am running
> on a host that trusted to do unauthenticated mail-in.
>
> Thanks
> Markus
>
> Am 13. April 2016 23:07:51 MESZ, schrieb Karl Wright <da...@gmail.com>:
>
>>
>> Hi Markus,
>>
>> The email notification connector was repurposed from the email repository
>> connector so the capabilities are somewhat limited and maybe not well
>> targeted as a result.  However, it is a very simple connector, and I
>> suspect that you could modify it easily to do what you need.  The only
>> question I'd have is whether it would continue to serve IMAP and POP3 users
>> as well at that point.
>>
>> Have a look at
>> https://svn.apache.org/repos/asf/manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/EmailSession.java
>>
>> This is where all the work is done.  The protocol is only used for
>> establishing that the connection is working; it's not used to actually send
>> email at all.  Session setup is therefore the important thing, and that's
>> done right there, using name/value pairs you can configure in the UI.
>> Here's a URL describing how to do that:
>>
>>
>> http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/
>>
>> Now, the only problem with that is that there is no session authenticator
>> declared in EmailSession, so I think that would need work to address.  I'm
>> happy to send you a patch, though, if you want to try it out.  I also would
>> love to have a better means of checking the connection that would not
>> involve a Store, since that supplies a password too but only for setting up
>> the Store object, which is used only for connection checks.
>>
>> There's also this reference:
>>
>> http://docs.oracle.com/javaee/6/api/javax/mail/Session.html
>>
>> ... which mentions smtp as a transport protocol, although that may not be
>> material if you set the appropriate other properties as described in the
>> example.
>>
>>
>> protocol=smtp; type=transport; class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc.;
>>
>>
>>
>> Anyhow, I'm more than willing to update the connector but it would be
>> great to know what I should actually do to it first.
>>
>> Karl
>>
>>
>>
>> On Wed, Apr 13, 2016 at 4:37 PM, Markus Schuch <ma...@web.de>
>> wrote:
>>>
>>> Hi,
>>>
>>> i wanted to try the email notification connector to send emails on job
>>> aborts.
>>>
>>> But couldn't get it working with our mx server. The email notification
>>> connector only offers POP3 or IMAP protocol. In my world these are for
>>> receiving emails. For sending i need SMTP. How am I supposed to configure
>>> that? (MCF 2.3)
>>>
>>> Thanks in advance
>>> Markus
>>
>>
> --
> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
> gesendet.
>

Re: E-Mail notifications over SMTP

Posted by Markus Schuch <ma...@web.de>.
Hi Karl,

i will try the Java mail properties you described.

I only concentrated on getting a positive connection working status so far. But now i understand this is not possible because the connection check would only work for POP3 or IMAP mail hosts. However, sending mails might still work with the mentioned properties. I will report back.

Authentication is not an issue for me at the moment because i am running on a host that trusted to do unauthenticated mail-in.

Thanks
Markus

Am 13. April 2016 23:07:51 MESZ, schrieb Karl Wright <da...@gmail.com>:
>Hi Markus,
>
>The email notification connector was repurposed from the email
>repository
>connector so the capabilities are somewhat limited and maybe not well
>targeted as a result.  However, it is a very simple connector, and I
>suspect that you could modify it easily to do what you need.  The only
>question I'd have is whether it would continue to serve IMAP and POP3
>users
>as well at that point.
>
>Have a look at
>https://svn.apache.org/repos/asf/manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/EmailSession.java
>
>This is where all the work is done.  The protocol is only used for
>establishing that the connection is working; it's not used to actually
>send
>email at all.  Session setup is therefore the important thing, and
>that's
>done right there, using name/value pairs you can configure in the UI.
>Here's a URL describing how to do that:
>
>http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/
>
>Now, the only problem with that is that there is no session
>authenticator
>declared in EmailSession, so I think that would need work to address. 
>I'm
>happy to send you a patch, though, if you want to try it out.  I also
>would
>love to have a better means of checking the connection that would not
>involve a Store, since that supplies a password too but only for
>setting up
>the Store object, which is used only for connection checks.
>
>There's also this reference:
>
>http://docs.oracle.com/javaee/6/api/javax/mail/Session.html
>
>... which mentions smtp as a transport protocol, although that may not
>be
>material if you set the appropriate other properties as described in
>the
>example.
>
>protocol=smtp; type=transport; class=com.sun.mail.smtp.SMTPTransport;
>vendor=Sun Microsystems, Inc.;
>
>
>Anyhow, I'm more than willing to update the connector but it would be
>great
>to know what I should actually do to it first.
>
>Karl
>
>
>
>On Wed, Apr 13, 2016 at 4:37 PM, Markus Schuch <ma...@web.de>
>wrote:
>
>> Hi,
>>
>> i wanted to try the email notification connector to send emails on
>job
>> aborts.
>>
>> But couldn't get it working with our mx server. The email
>notification
>> connector only offers POP3 or IMAP protocol. In my world these are
>for
>> receiving emails. For sending i need SMTP. How am I supposed to
>configure
>> that? (MCF 2.3)
>>
>> Thanks in advance
>> Markus

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

Re: E-Mail notifications over SMTP

Posted by Karl Wright <da...@gmail.com>.
Hi Markus,

The email notification connector was repurposed from the email repository
connector so the capabilities are somewhat limited and maybe not well
targeted as a result.  However, it is a very simple connector, and I
suspect that you could modify it easily to do what you need.  The only
question I'd have is whether it would continue to serve IMAP and POP3 users
as well at that point.

Have a look at
https://svn.apache.org/repos/asf/manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/EmailSession.java

This is where all the work is done.  The protocol is only used for
establishing that the connection is working; it's not used to actually send
email at all.  Session setup is therefore the important thing, and that's
done right there, using name/value pairs you can configure in the UI.
Here's a URL describing how to do that:

http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/

Now, the only problem with that is that there is no session authenticator
declared in EmailSession, so I think that would need work to address.  I'm
happy to send you a patch, though, if you want to try it out.  I also would
love to have a better means of checking the connection that would not
involve a Store, since that supplies a password too but only for setting up
the Store object, which is used only for connection checks.

There's also this reference:

http://docs.oracle.com/javaee/6/api/javax/mail/Session.html

... which mentions smtp as a transport protocol, although that may not be
material if you set the appropriate other properties as described in the
example.

protocol=smtp; type=transport; class=com.sun.mail.smtp.SMTPTransport;
vendor=Sun Microsystems, Inc.;


Anyhow, I'm more than willing to update the connector but it would be great
to know what I should actually do to it first.

Karl



On Wed, Apr 13, 2016 at 4:37 PM, Markus Schuch <ma...@web.de> wrote:

> Hi,
>
> i wanted to try the email notification connector to send emails on job
> aborts.
>
> But couldn't get it working with our mx server. The email notification
> connector only offers POP3 or IMAP protocol. In my world these are for
> receiving emails. For sending i need SMTP. How am I supposed to configure
> that? (MCF 2.3)
>
> Thanks in advance
> Markus