-
Notifications
You must be signed in to change notification settings - Fork 15
Mail Receiver
German Escobar edited this page Jun 19, 2013
·
5 revisions
A connector that receives Email messages through IMAP or IMAPS.
The following is a simple XML configuration of the Mail Receiver for GMail that you would add to applications.xml or connections.xml:
<connector id="mail-test" className="org.mokai.connector.mail.MailReceiver">
<configuration>
<property name="host">imap.gmail.com</property>
<property name="tls">true</property>
<property name="username">[email protected]</property>
<property name="password">p4ssword</property>
</configuration>
</connector>| Property | Default | Description |
|---|---|---|
| host | localhost | The IP or host name of the email server. |
| tls | false | true of false. Use TLS? |
| port | -1 | The port in which the email server is listening. -1 to use the default port. |
| username | The username used to authenticate. | |
| password | The password used to authenticate. | |
| folder | INBOX | The folder to fetch from. |
| reconnectDelay | 5000 | If the connection fails, wait for the specified time before trying to reconnect. |
| unseen | true | Only process unseen messages. |
| delete | true | Delete processed messages. |
The most common use case of receiving an Email is to convert it to an SMS message. This is why I have included a built-in solution in this connector.
Currently there are two options that you can choose in the configuration:
- Use the subject of the email as the mobile number (the body of the email will become the text of the SMS).
- Send all messages to a fixed mobile number (the subject will be included in the email).
<connector id="mail-test" className="org.mokai.connector.mail.MailReceiver">
<configuration>
<!-- see above, not included for brevity -->
</configuration>
<post-receiving-actions>
<action className="org.mokai.action.mail.EmailToSmsAction">
<property name="useSubjectAsTo">true</property>
<property name="smsFrom">3768</property>
</action>
</post-receiving-actions>
</connector>
<connector id="mail-test" className="org.mokai.connector.mail.MailReceiver">
<configuration>
<!-- see above, not included for brevity -->
</configuration>
<post-receiving-actions>
<action className="org.mokai.action.mail.EmailToSmsAction">
<property name="smsTo">13201111111</property>
<property name="smsFrom">1234</property>
</action>
</post-receiving-actions>
</connector>
| Property | Default | Description |
|---|---|---|
| useSubjectAsTo | false | Use the subject of the email as the mobile number. The property `smsTo` must not be present. |
| smsTo | Use a fixed mobile number where all the messages are sent. The property "useSubjectAsTo" must not be present of must be set to false. | |
| smsFrom | 12345 | The string that will be set in the "from" property of the message |
| textLength | 160 | The max length to allow. If the message is longer, it will be cut. |