Send emails from personal email with formula.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Emmker
    Member
    • Nov 2023
    • 64

    Send emails from personal email with formula.

    I was trying to send an email with Before-save formula script, that looks something like that:

    PHP Code:
    .......
    .......
    .......
    
    ifThen(
             requestId && contactId,
             $emailId = record\create(
    'Email',
    'to', $to,
    'subject', 'Προσφορά Ακινήτου',
    'body', string\concatenate(property.description, '\n',description, '\n','\n', "Τιμη: ",amount,'€'),
    'isHtml', false,
    'status', 'Sending',
    'attachmentsIds', $attachmentList,
    'parentId', id,
    'parentType', 'Opportunity')
    );
    
    ext\email\send($emailId)
    That, works fine with the shared Outbound Emails but if I want to send that email with a personal email, whatever I do, does not work.

    I have tried adding:

    PHP Code:
    $fromEmail = assignedUser.emailAddress;
    $fromName = assignedUser.name
    
    ifThen(
             requestId && contactId,
             $emailId = record\create(
    'Email',
    'to', $to,
    'fromEmail', $fromEmail,
    'fromName', $fromName,
    'subject', 'Προσφορά Ακινήτου',
    'body', string\concatenate(property.description, '\n',description, '\n','\n', "Τιμη: ",amount,'€'),
    'isHtml', false,
    'status', 'Sending',
    'attachmentsIds', $attachmentList,
    'parentId', id,
    'parentType', 'Opportunity')
    );
    
    ext\email\send($emailId)​​ 
    
    with no luck.

    Should I do something else to clarify that I need the email sent from the personal email account?
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #2
    you can put the from Email in the formula as string:

    'from', 'from-address@test.com'

    Comment


    • Emmker
      Emmker commented
      Editing a comment
      Is it different than 'fromEmail' that I used?
  • yuri
    Member
    • Mar 2014
    • 8440

    #3
    There's no such field 'fromEmail' in Espo.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • Emmker
      Member
      • Nov 2023
      • 64

      #4
      Originally posted by yuri
      There's no such field 'fromEmail' in Espo.
      I have changed the formula to:

      PHP Code:
      ifThen(
               requestId && contactId,
               $emailId = record\create(
      'Email',
      'to', $to,
      'from', $fromEmail,
      'fromName', $fromName,
      'subject', 'Προσφορά Ακινήτου',
      'body', string\concatenate(property.description, '\n',description, '\n','\n', "Τιμη: ",amount,'€'),
      'isHtml', false,
      'status', 'Sending',
      'attachmentsIds', $attachmentList,
      'parentId', id,
      'parentType', 'Opportunity')
      );
      
      ext\email\send($emailId)
      
      and now I get:
      ERROR: Formula function: ext\email\send, Error while sending. Message: No SMTP params for sender@testemail.com..

      I checked the smtp settings for the personal email 'sender@testemail.com' and sent a test email too. I am sure they are working fine.
      But still getting the No SMTP params

      Comment

      • shalmaxb
        Senior Member
        • Mar 2015
        • 1602

        #5
        instead of 'from', $fromEmail,

        put

        'from', 'sender@testmail.com',

        Comment

        • Emmker
          Member
          • Nov 2023
          • 64

          #6
          Originally posted by shalmaxb
          instead of 'from', $fromEmail,

          put

          'from', 'sender@testmail.com',
          I just did.
          Even if I hardcode the address it gives the same message. No SMTP params for ...

          Comment

          • shalmaxb
            Senior Member
            • Mar 2015
            • 1602

            #7
            Also, you can try to gather more info about this error. Open the data/config.php file, and find the next line: 'level' => 'WARNING', and change it to 'level' => 'DEBUG',. After, reproduce this error and investigate the error log file in the data/logs directory.

            Comment


            • Emmker
              Emmker commented
              Editing a comment
              Just did it, rebooted to be sure, and the same message. no extra info in the logs.
          • shalmaxb
            Senior Member
            • Mar 2015
            • 1602

            #8
            Is there anything configured in the user of the personal email account regarding Email?

            Comment

            • Emmker
              Member
              • Nov 2023
              • 64

              #9
              Originally posted by shalmaxb
              Is there anything configured in the user of the personal email account regarding Email?
              Yes. The user has a personal email configured. Tested and working fine.

              Comment


              • shalmaxb
                shalmaxb commented
                Editing a comment
                in the user preferences there should not be configured smtp

              • Emmker
                Emmker commented
                Editing a comment
                The user has a personal email configured, which is the same as the user email.
                The personal email smtp works fine when I test it. It also works fine when I create a new email and send it manually.
                The only problem that I have is that when I try to send it via the formula, it gives the "No SMTP params" problem
            Working...