PHP code example of satis / incomingmail

1. Go to this page and download the library: Download satis/incomingmail library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

satis / incomingmail example snippets



[
    "table" => "my_table", // Represents the name of the table in which you want to save the different received mails
    "message_format" => "html_text", // The format in which you want to save the messages received from the mail :
    // html_text => to save the message in html format and plain_text for plain text
    "object" => [ // The different fields that will be taken into account to record in the table
        "first_name" => "first_name", // Customize the name of the first name field of the sender
        "last_name" => "last_name", // Customize the name of the sender "s name field
        "email" => "email", // Customize the name of the email field
        "message" => "message", // Customize the field name of the message to be saved
        "date" => "date", // Customize the field name of the date the mail was sent
        "attachments" => "attachments", // Customize the name of the file field, this field is of type json
    ],
    "app_registration" => [ //Incoming mail service subscription information
        "app_name" => 'Care - Rwanda', // Name of your application,
        "url" => 'http://localhost:8000/api/incoming/mail', // Registration link for incoming mail
        "mail_server" => 'smtp.gmail.com', // Mail host
        "mail_server_username" => '[email protected]', // Mail username
        "mail_server_password" => '****', // Mail password
        "mail_server_port" => '587', // Mail port
        "app_login_url" => 'http://localhost:8000/api/auth', // Api authentication
        "app_login_params" => [ // Information to connect to your project. The different colunms to change following
            // arguments needed to connect to your project
            "grant_type" => "password",
            "client_id" => "*****************",
            "client_secret" => "*****************************",
            "username" => "[email protected]",
            "password" => "******"
        ],
    ]
;

'app_login_params' => [
            "email" => "[email protected]",
            "password" => "123456"
        ];

use App\Http\Controllers\IncomingMail\IncomingMailController;
Route::post('satis/incoming/mail', [IncomingMailController::class, 'register']);
console
php artisan vendor:publish --provider="Satis\Incomingmail\IncomingmailServiceProvider"
console
php artisan incomingmailregistration:install
console
	use GeneralMail{
        register as registerMail;
    }

    public function register(Request $request){
        $addData = [
            "request_channel_slug"=>"email",
            "response_channel_slug"=>"email",
        ];
        return $this->registerMail($request,$addData);
    } 
console
	use ClaimMail{
        register as registerClaim;
    }

    public function register(Request $request){
        $addData = [
            "request_channel_slug"=>"email",
            "response_channel_slug"=>"email",
        ];
        return $this->registerClaim($request,$addData);
    }