Button to type RUN to communication

Button to type RUN to communication

Hi, I have a grid, I created a button type RUN and now the selection field for each record in the grid.
I wish I could select one or more records that are customer and be able to send them an email.
How can I add a function to send email?

If you go into the onrecord event of your button then you can send the email. To send the email you can use the standard code-snippet SC is offering. Just click on any ‘regular’ event and click on the email green spot. It will generate a code snippet to send the mail, you can cut and paste into your onrecord run event.

I apologize.
So once you have created the RUN button at the bottom where I can write code, I need to enter the following code:

/ **

  • Send an email with attachment
  • /

// Email parameters
$ mail_smtp_server = ‘smtp.example.com’; // SMTP server name or IP address
$ mail_smtp_user = ‘login’; // SMTP username
$ mail_smtp_pass = ‘password’; // SMTP password
$ mail_from = ‘me@example.com’; // From email
$ mail_to = ‘you@example.com’; // To email
$ mail_subject = ‘Test message’; // Message subject
$ mail_message = ‘This is a test message.’; // Message body
$ mail_format = ‘T’; // Message format: (T) or ext (H) tml
$ mail_attachments = array (// List of attached files (located on the web server)
‘/path_to_file/attached_file.txt’
);

// 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_attachments);

peraziende,

Just click on the button in the left pane, under “Buttons” just where you clicked to create the new button.

At the bottom center of the screen will appear an editor that lets you enter the code. At the top of the editor, you can choose your button event.

Hope this helps,

Dave