Announcement

Collapse
No announcement yet.

Save email sent APP control and error message

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

  • #16
    Hello, I think I'm one step away from the solution, I took part in the code that records the data in the database of the historical communications and I modified some code.
    Now grig communicating properly to control application selected emails and printing in the field of recipients in this way;
    (info @ aaa.com, max @ bbb.com)

    But when I click send email me error and tells me;

    Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox Given [SELECT GROUP_CONCAT (email SEPARATOR'] does not comply with RFC 2822, 3.6.2. 'In/web/htdocs/www.AAAAAAA.com/home/admin/ammingestionale/_lib/prod/third/swift/classes/Swift/Mime/Headers/MailboxHeader.php:308 Stack trace: # 0/web/htdocs/www.AAAAAAA.com/home/admin/ammingestionale/_lib/prod/third/swift/classes/Swift/Mime/Headers/MailboxHeader.php(238): Swift_Mime_Headers_MailboxHeader -> _ assertValidAddress ('SELECT GROUP_CO ...') # 1/web/htdocs/www.AAAAAAA.com/home/admin/ammingestionale/_lib/prod/third/swift/classes/Swift/Mime/Headers/MailboxHeader.php(96): Swift_Mime_Headers_MailboxHeader-> normalizeMailboxes (Array) # 2/web/htdocs/www.AAAAAAA.com/home/admin/ammingestionale/_lib/prod/third/swift/classes/Swift/Mime/Headers/MailboxHeader.php(60): Swift_Mime_Headers_MailboxHeader-> setNameAddresses (Array) # 3/web/htdocs/www.AAAAAAA.com/home/admin/ammingestionale/_lib/prod/third/swift/classes/Swift/Mime/SimpleHeaderFactory.php(6 in/web/htdocs/www.AAAAAAA.com/home/admin/ammingestionale/_lib/prod/third/swift/classes/Swift/Mime/Headers/MailboxHeader.php on line 308
    Here is all the code in onValida of my control;


    $ email_sql = "SELECT GROUP_CONCAT (email SEPARATOR ';') FROM WHERE email fornitorischede IN [var_email_to]";
    sc_lookup (rs, $ email_sql);
    if (isset (rs {[0] [0]}))
    {
    var_mail_to $ rs = {[0] [0]};
    }
    $ var_email_invio email_invio = {};
    $ var_oggetto = {object};
    $ var_messaggio = {text};

    / **
    * Send a simple email
    * /

    // Email parameters
    $ mail_smtp_server = 'smtp.aaaaaa.com'; // SMTP server name or IP address
    $ mail_smtp_user = 'info@aaaaaa.com'; // SMTP user name
    $ mail_smtp_pass = 'aaaaaaaaa'; // SMTP password
    $ = $ mail_from var_email_invio; // From email
    $ = $ mail_to email_sql; // To email
    $ = $ mail_subject var_oggetto; // Message subject
    $ = $ mail_message var_messaggio; // Message body
    $ mail_format = 'H'; // Message format: (T) ext or (H) tml

    // Send email ";
    sc_mail_send ($ mail_smtp_server,
    $ mail_smtp_user,
    $ mail_smtp_pass,
    $ mail_from,
    $ mail_to,
    $ mail_subject,
    $ mail_message,
    $ mail_format);

    if ({} sc_mail_ok)
    {
    $ result = "Email Sent Successfully !!";
    }
    else
    {
    $ result = {} sc_mail_erro;
    }

    Comment


    • #17
      Change this line:
      $ = $ mail_to email_sql; // To email <-----

      To
      $mail_to = $var_mail_to;

      jsb

      Comment


      • #18
        Hello, I have modified and made the test is selecting a single recipient with two recipients, the answer I have is always the same;
        Undefined variable: var_mail_to

        Yet in the field email_to emails that I select from the grid are inserted properly ......

        Where can I hide the error ?????

        Comment


        • #19
          $ email_sql = "SELECT GROUP_CONCAT (email SEPARATOR ';') FROM WHERE email fornitorischede IN [var_email_to]";
          sc_lookup (rs, $ email_sql);
          if (isset (rs {[0] [0]}))
          {
          $var_mail_to = rs{[0] [0]};
          }


          Check your SQL statement after the FROM keyword. You don't get a result if it is like the above, hence $var_mail_to is not defined.

          jsb

          Comment


          • #20
            Hello, thank you so much for your patience, unfortunately the error remains, I believe that is in the application code control.

            The database name doce the grid passes the email is: fornitorischede
            the email field is called email

            and my application code control is:

            $email_sql = "SELECT GROUP_CONCAT (email SEPARATOR ';') FROM fornitorischede WHERE email IN [var_email_to]";
            sc_lookup(rs,$email_sql);
            if(isset({rs[0][0]}))
            {
            $var_mail_to = {rs[0][0]};
            }
            $var_email_invio = {email_invio};
            $var_oggetto = {oggetto};
            $var_messaggio = {text};

            /**
            * Send a simple email
            */

            // Email parameters
            $mail_smtp_server = 'smtp.AAAAAAA.com'; // SMTP server name or IP address
            $mail_smtp_user = 'info@AAAAAAA.com'; // SMTP user name
            $mail_smtp_pass = 'VVVVVVVVVVVV'; // SMTP password
            $mail_from = $var_email_invio; // From email
            $mail_to = $var_mail_to; // To email
            $mail_subject = $var_oggetto; // Message subject
            $mail_message = $var_messaggio; // Message body
            $mail_format = 'H'; // Message format: (T)ext or (H)tml

            // Send email";
            sc_mail_send($mail_smtp_server,
            $mail_smtp_user,
            $mail_smtp_pass,
            $mail_from,
            $mail_to,
            $mail_subject,
            $mail_message,
            $mail_format);

            Comment


            • #21
              OK.

              Back to the grid.

              Run OnRecord:
              [arr_email_to][] = {supplier_id}; <-- the name supplier_id is an example, it has to be the name of the primary_key field of your fornitorischede table.


              Control app

              $email_sql = "SELECT ... WHERE email IN [var_email_to]"; <-- again, the field (email) in the WHERE clause has to be the name of the primary_key field of your fornitorischede table. It is the same as above.


              jsb

              Comment


              • #22
                I tried but it does not work, but I think I understand where the error is.
                From the database through the grid fornitorischede I step the email field, but the email field is the primary key of the DB, its primary key is the field ID

                how it changes the grid and control ??????

                please help me why it is important to do other related applications.

                Comment

                Working...
                X