Aller à : navigation, rechercher

Socle Technique / Mail Capture module

Summary

The documentation of this tool is now at : https://labs.maarch.org/maarch/MaarchCourrier.doc

Retrieve this module via our svn : mail_capture from svn

mail_capture is a Maarch module which allows you to archive e-mails and attachments in Maarch with imap protocol.

We use the php_imap library.

This Maarch module proposes a batch allowing the storing of e-mails and works on Linux or Windows OS.

The module prepares the e-mails and their attachments for the Maarch web service client..

mail_capture module tree structure

    /mail_capture
        /log
            /2009_02_18
               mail_capture_2009_02_18 10-11-47.log
                ...
            ...
        /postprocess_scripts
            /format_with_xml
                format_with_xml.php
            /maarch_ws_client
                maarch_ws_client.php
        /preprocess_scripts
        /scripts
            launch_mail_capture.bat.default
            launch_mail_capture.sh.default
        /tmp
            ...
        /xml
            config.xml.default
            config_postprocess_ai.xml
            config_postprocess_ws.xml.default
        class_mailcapture.php
        mail_capture.php

Config.xml

<?xml version="1.0" encoding="utf-8" ?>
<mailcapture>
	<parameters>
                <!-- Path of the module -->
		<SCRIPT_DIRECTORY>C:\xampp\htdocs\maarch_entreprise\modules\mail_capture\</SCRIPT_DIRECTORY>
                <!-- Path of the tmp folder -->
		<TMP_DIRECTORY>C:\xampp\htdocs\maarch_entreprise\modules\mail_capture\tmp\</TMP_DIRECTORY>
                <!-- Path of the scripts of the preprocess -->
		<PREPROCESS_SCRIPT></PREPROCESS_SCRIPT>
                <!-- Path of the config of the preprocess -->
                <PREPROCESS_XML_FILEPATH></PREPROCESS_XML_FILEPATH>
                <!-- Path of the scripts of the postprocess -->
                <POSTPROCESS_SCRIPT>C:\xampp\htdocs\maarch_entreprise\modules\mail_capture\postprocess_scripts\maarch_ws_client\maarch_ws_client.php</POSTPROCESS_SCRIPT>
                <!-- Path of the config of the postprocess -->
                <POSTPROCESS_XML_FILEPATH>C:\xampp\htdocs\maarch_entreprise\modules\mail_capture\xml\config_postprocess_ws.xml</POSTPROCESS_XML_FILEPATH>
                <!-- flag to delete the mail on the server -->
                <DELETE_MAIL>true</DELETE_MAIL>
                <!-- flag to enabled the debug mode -->
                <DEBUG_EXTRACT_FILES>false</DEBUG_EXTRACT_FILES>
	</parameters>
	<mailbox>
                <!-- imap only -->
		<mailbox>{imap.gmail.com:993/imap/ssl}INBOX</mailbox> 
                <login>myaacount</login>
                <password>mypassword</password>
                <!--regular expression for mail from -->
                <from_regex></from_regex>
        </mailbox>
	<!-- another box-->
        <mailbox>
               <mailbox>{imap.gmail.com:993/imap/ssl}INBOX</mailbox>
               <login>myaacount2</login>
               <password>mypassword</password>
               <from_regex></from_regex>
        </mailbox>
</mailcapture>

config_postprocess_ws.xml

the config file of the store resource web service in Maarch

<ROOT>
    <CONFIG>
        <WS_SERVER>http://127.0.0.1/maarch_entreprise/ws_server.php?WSDL</WS_SERVER>
        <COLL_ID>letterbox_coll</COLL_ID>
        <TABLE_NAME>res_letterbox</TABLE_NAME>
        <LOGIN_MAARCH>superadmin</LOGIN_MAARCH>
        <PWD_MAARCH>superadmin</PWD_MAARCH>
        <STATUS>MAQUAL</STATUS>
        <TYPE_ID>1</TYPE_ID>
    </CONFIG>
</ROOT>

How to launch the batch

In the directory "scripts" you will find the files necessary to the launching of the module.

You must modify these files so that launching is carried out correctly.

launch_mail_capture.bat contains :

"C:\xampp\php\php.exe" c:\xampp\htdocs\maarch_entreprise_trunk\modules\mail_capture\mail_capture.php  c:\xampp\htdocs\maarch_entreprise_trunk\modules\mail_capture\xml\config.xml

You can launch it with your scheduler program or the CRON.

How to retrieve emails in Maarch

There are two baskets for emails :

  • EmailsToQualify

Emails to qualify


  • MyEmailsToQualify

here you can see a new keyword for the basket query : @email -> it contains the email of the connected user

My emails to qualify

-> This basket contains emails that I transferred to the dedicated box archive

1 : the email body

2 : the email attachments

My emails to qualify content

-> Then you can qualify the email

1 : the email body text

2 : the specifics customs fields

Qualification of the email