noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
ajax_email_setting.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19*/
20// Copyright Author Dany De Bontridder danydb@noalyss.eu 21.10.2025
21
22
23/**
24 * @file
25 * @brief email setting see email_setting.inc.php (C0ML)
26 */
27use PHPMailer\PHPMailer\PHPMailer;
28use PHPMailer\PHPMailer\SMTP;
31/**
32 * test email
33 */
34try {
35 $op2=$http->request("op2");
36} catch (Exception $exc) {
37 \record_log($exc);
38 return;
39}
40
41//------------------------------------------------
42// Test SMTP Parameter
43//------------------------------------------------
44if ( $op2 == 'parameter_test_smtp')
45{
46 try {
47 $mail_test=$http->get("email_test");
48 $mail_parameter=new Mail_Parameter(
49 $cn
50 ,"TEST");
51 $mail_parameter->from_get();
52 $mail=new SMTPMail($mail_parameter);
53 $e=$mail->getPhpmailer();
54 $e->SMTPDebug=SMTP::DEBUG_CONNECTION;
55 $mail->mailto($mail_test);
56 $mail->set_subject(_("Test envoi email").date("d-m-Y H:i"));
57 $mail->set_message(_("Test de votre configuration"));
58 $mail->compose();
59 $mail->send();
60
61 } catch (Exception $exc) {
62 echo $exc->getTraceAsString();
63 }
64 return;
65}
66//------------------------------------------------
67// save smtp configuration
68//------------------------------------------------
69if ( $op2 == "save_config_smtp")
70{
71 try {
72 $mail_parameter=new Mail_Parameter(
73 $cn
75 );
76 $mail_parameter->from_post();
77 $mail_parameter->save();
78 echo 'OK';
79 } catch (Exception $exc) {
80 \record_log($exc);
81 echo 'NOK';
82 }
83 return;
84}
85
86
87throw new \Exception( "NOK INVALID ACTION" );
record_log($p_message)
Record an error message into the log file of the server or in the log folder of NOALYSS Record also t...
_("actif, passif,charge,...")
configuration email and test PHPMAILER.
const MAIL_SETTING_NOALYSS
Definition constant.php:393
if(count($exist_request)> 1) $mail
Definition recover.php:100