Mail Server Solution(2)Camel Test and NodeJS Mailin

本文探讨了多种邮件处理技术,包括使用MailServerSolution发送邮件、通过Camel进行邮件消费遇到的问题及解决办法,以及采用Node.js开源解决方案如smtp-server和mailin进行邮件收发的技术实践。
Mail Server Solution(2)Camel Test and NodeJS Mailin

1. dyn emails
https://help.dyn.com/email-api/
It supports to send email, but not mange incoming emails.

2. Investigate on Camel
I get a project set up in sillycat-camel. It is a very good project, but it seems to me that it does not designed to do that.

Error Message:
Protocol smtp cannot be used for a MailConsumer. Please use another protocol such as pop3 or imap.
Solution:
Camel does not support use smtp as a consumer endpoint.

Some of the idea in camel is really great.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<value>
classpath*:config.properties
</value>
</list>
</property>
</bean>

<context:annotation-config />
<context:component-scan base-package="com.sillycat">
</context:component-scan>

<!-- my lovely spring, long time no see -->
<bean id="testBean" class="com.sillycat.supercamel.TestBeanImpl"/>

<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://localhost?broker.persistent=false" />
</bean>
<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory"
init-method="start" destroy-method="stop">
<property name="maxConnections" value="8" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="pooledConnectionFactory" />
</bean>

<bean id="beanProcessor" class="com.sillycat.supercamel.BeanProcessor"/>

<camelContext xmlns="http://camel.apache.org/schema/spring">
<endpoint id="testBeanUriHelloMethod" uri="bean:testBean?method=hello"/>
<route>
<from uri="activemq:queue:start" />
<to ref="testBeanUriHelloMethod" />
<to uri="stream:out" />
</route>

<route>
<from uri="timer:foo?period=1s" />
<from uri="activemq:queue:timer" />
<transform>
<simple>Heartbeat1 ${date:now:yyyy-MM-dd HH:mm:ss}</simple>
</transform>
<to uri="bean:testBean?method=hello" />
<to uri="activemq:queue:in" />
</route>
<route>
<from uri="activemq:queue:in" />
<log message="Route message from inbox to outbox queue with data ${body}" />
<to uri="stream:out" />
</route>

<route>
<from uri="timer:foo?period=1s" />
<process ref="beanProcessor"/>
<to uri="stream:out" />
</route>

</camelContext>


</beans>

SendGrid
We are going to use SendGrid for company.

NodeJS OpenSource Solution
https://github.com/andris9/smtp-server smtp-server
https://github.com/andris9/smtp-connection smtp-client
https://github.com/andris9/simplesmtp deprecated
https://github.com/andris9/mailparser mail parse
http://mailin.io/ smtp to post server
https://github.com/eleith/emailjs send email

Mailin is using mailparse to parse the email, it supports to fetch the attachment files. Then it depends on simplesmtp to handle the smtp server side protocol. Then it post the form with the attachment to the URL you provide there.

Try to Install mailing on my raspberry
> node --version
v0.12.1

> python --version
Python 2.7.3

> sudo apt-get install spamassassin
> sudo vi /etc/default/spamassassin
ENABLED=1

Install the mailin server
> sudo npm install -g mailin

I am using HTTP mock Server
http://requestb.in/zye6onzy

Start the SMTP Server
> sudo mailin --webhook http://requestb.in/zye6onzy


References:
http://camel.apache.org/
http://camel.apache.org/components.html
https://github.com/rmortale/EmailService
http://camel.apache.org/mail.html

http://raising.iteye.com/blog/2223900
https://github.com/normanmaurer/camel-smtp
http://examples.javacodegeeks.com/enterprise-java/apache-camel/apache-camel-spring-example/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值