Announcement

Collapse
No announcement yet.

Mail Link for multiple Records

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

  • Mail Link for multiple Records

    Hi
    when i click on the "email" button in a record, my outlook opens to send the user an email (mailto:test@example.com).

    But how can i do this in a grid?

    I want display a clickable link which contains every e-Mail Adresses in the grid, separated by ";". In the "onRecord" Event i can make a variable which contains the correct text like "mailto:test@example.com;test2@example.com.... ."

    But how can i show this link in the grid, so i can click on it?

    Thank's for any idea.

    Best regards
    Steve

  • #2
    Afaik, if you make the field of type email then a link will be generated. Other option is to apply an email button and apply a link to a blank application or control to perform the email.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Originally posted by aducom View Post
      Afaik, if you make the field of type email then a link will be generated. Other option is to apply an email button and apply a link to a blank application or control to perform the email.
      OR ..
      Step 1. Create the PHP method (aka function) to send the mail
      Step 2. Call that function from the appropriate event (this is called from OnAfterInsert)

      PHP Method:
      $sql = "SELECT
      email
      FROM
      sec_users
      WHERE
      group_id = 1" ; //Administator only

      sc_lookup(rs,$sql);

      $emails_admin = array();
      if({rs} !== FALSE && count({rs}) != 0)
      {
      foreach({rs} as $value)
      $emails_admin[] = $value[0];
      }
      //2014-0826:bh Changed implode to use semi-colon rather than comma
      //To correct error RFC 2822 compliance
      $emails_admin = implode('; ', $emails_admin);

      // 2015-0814:bh Modified to get smtp settings from table (was hard coded)
      // Get SMTP Settings
      sc_lookup(dataset, "select smtp_host, smtp_user, smtp_pass, smtp_email, smtp_port from smtp_settings where active = 'Y'");

      if ({dataset} === false)
      {
      echo "Access error. Message=". {dataset_erro} ;
      }
      elseif (empty({dataset}))
      {
      echo "Select command didn't return data";
      }
      else
      {
      // Email parameters
      $mail_smtp_server = {dataset[0][0]}; // SMTP server name or IP address
      $mail_smtp_user = {dataset[0][1]}; // SMTP user name
      $mail_smtp_pass = {dataset[0][2]}; // SMTP password
      $mail_from = {dataset[0][3]}; // From email
      $mail_port = {dataset[0][4]}; // SMTP port
      $mail_to = $emails_admin ; // Mail to administrators

      $mail_message = sprintf({lang_new_user_sign_in}, {name}, {email}, {email});
      $mail_subject = {lang_subject_mail_new_user};
      $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,
      '','', $mail_port, '');
      }

      Comment


      • #4
        Hi
        thank's.. i think the answer from Albert help me. I'm not want to send an email with scriptcase. I only want a button like in the single record form: If you press, mailapplication opens and you can write the e-Mail. But as i say: for every user in the grid together. Like:"mailto:user1@example.com;user2@example.com;u ser3@example.com"

        Best regards
        Steve

        Comment

        Working...
        X