Announcement

Collapse
No announcement yet.

IMAP and SMTP configuration by API

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • IMAP and SMTP configuration by API

    Is it possible to add IMAP and SMTP configurations with the API?


  • #2
    Hi robert_cooke,

    In fact, everything in EspoCRM works through API requests. So, it is possible to configure IMAP and SMTP for any email account through API, but you will have to use basic authorization (for example, using administrator credentials).

    You can try to send the following request:

    PUT http://localhost/espocrm/api/v1/EmailAccount/[id-of-your-email-account]

    Payload for IMAP configuration:

    {
    "useImap": true,
    "host": "imap.gmail.com",
    "port": 993,
    "security": "SSL",
    "username": "test@gmail.com"
    }

    Payload for SMTP configuration:​

    {
    "useSmtp": true,
    "smtpHost": "smtp.gmail.com",
    "smtpPort": 587,
    "smtpAuth": true,
    "smtpSecurity": "TLS",
    "smtpUsername": "test@gmail.com",
    "smtpAuthMechanism": "login"
    }​

    Note that email address passwords must be entered manually (unless you are using Google or Outlook Integration extensions, but even in this case, you will need to go through the UI and connect the integration).

    Comment


    • #3
      Thank you this will really help me. I love EspoCRM I just moved from SuiteCRM which was a total headache.
      Last edited by robert_cooke; 06-17-2023, 07:37 AM.

      Comment


      • #4
        As an API user does not have access to group email accounts and email accounts of users, you need to authenticate as an admin user using basic authorization. https://docs.espocrm.com/development...authentication.

        More secure way would be to use an API user and create IMAP configuration not directly, but with some formula script. Though it requires deeper knowledge of Espo.
        Last edited by yuri; 06-17-2023, 02:13 PM.

        Comment


        • #5
          I decided to try your solution with the "formula script". Could you give some guidance on how to go about this. I was also thinking of creating an extension or would that be overkill? In the sandbox I don't seem to have access to the group email accounts.

          It would be great if I could upload a csv file with accounts like this. Would it be doable for me to extend the importer so it can do this?

          Click image for larger version

Name:	image.png
Views:	72
Size:	6.4 KB
ID:	99970
          Last edited by robert_cooke; 11-22-2023, 12:45 PM.

          Comment


          • #6
            I was able to solve this with a plain java http request to the api with a admin basic auth request.

            Comment

            Working...
            X