Error sending email with tennis control.

Error sending email with tennis control.

Hi, I created an application-type control to open a form where the user can send an email by writing the address that sends email address and receiving email

Send email = $ var_email_invio
Email receiving = $ var_email_to

But trying the email is not sent.
Where did I go wrong ???


$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 = ‘AAAAAAAA’; // SMTP password
$mail_from = $var_email_invio; // From email
$mail_to = $var_email_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);

at the look of it, it looks like the generated snippet and nothing is wrong. But there could be a lot of issues: smtp server setting wrong, userid/password wrong, port wrong etc. etc. In general you would get a swift error telling you what’s going on, so could you publish the errormessage?

Hello, I checked and emails arrive correctly.
But I would insert a very important function.
I have a grid and I would like to create a button in the grid record selection from which to take and pass only the email in the following function in your application control:
$ = $ mail_to var_email_to;

how can I join the grid with selection to the application of control?

What you need is a ‘Run’ button.

http://www.scriptcase.net/docs/en_us/v8/grid-applications/grid/buttons/run-button

Here is idea behind it.

onScriptInit: [arr_email_to] = array(); //create an array for the email addresses

onRecord: [arr_email_to] = {email_address}; //collect the selected email addresses

onFinish:
if(count([arr_email_to]) > 0)
{
$var_email_to = implode(’;’,[arr_email_to]);
//now do your email stuff here or redirect and pass $var_email_to onto your email app
}

Hope this helps.

jsb

Thanks for the information but does not work … help me find the error?

Here is my code in the grid:
onScriptInit: [arr_email_to] = array ();

then in the RUN button I entered the data which then are used to switch to control application that needs to send email and it is called; control_email_fornitori

here is the code in RUN

Run OnRecord:
[arr_email_to] = {email};

Run OnFinish
if (count ([arr_email_to])> 0)
{
$ var_email_to = implode (‘control_email_fornitori;’, [arr_email_to]);
// now do your stuff here or email redirects and pass $ var_email_to onto your email app
}

where wrong ???

Thanks for the advice.

Please first test the smtp mailing code by sending a simple text message so that you know that that part works.

Damn! That happens when you write posts while you actually should be in bed. :slight_smile:
Where are the proof reader? :smiley:

Here is the correction.
Instead of

Run OnRecord:
[arr_email_to] = {email};

It has to be

Run OnRecord:
[arr_email_to][] = {email};

Now change your onFinish code

Run OnFinish
if (count ([arr_email_to])> 0)
{
$var_email_to = implode (’;’, [arr_email_to]);
sc_redir(control_email_fornitori,var_email_to = $var_email_to);
}

Head over to your email control app and change your $mail_to variable.

$mail_to = [var_email_to];

Good luck :slight_smile:

jsb

Infinitely thanks … because now it works perfectly.

From the time you tried to solve this function.

thanks eeeeeeeeee