0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.21.104.16


Current Path : /var/www/html/oums/src/
Upload File :
Current File : /var/www/html/oums/src/api_sendmail.php

<?php
error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
function send_mail($mail_main, $mail_copy, $mail_bccy, $mail_subj, $mail_text, $mail_file)
{
    $resp_stat = "F";
    include("sys_connect.php");
    $mysql = "select * from sys_control";
    $myres = mysqli_query($mycon, $mysql);
    while ($row = mysqli_fetch_assoc($myres)) {
        $mail_host = $row['fmailhost'];
        $mail_port = $row['fmailport'];
        $mail_user = $row['fmailuser'];
        $mail_pswd = $row['fmailpswd'];
        $mail_name = $row['fmailname'];
    }

    require_once "phpmailer/class.phpmailer.php";
    $mail = new PHPMailer(true);
    $mail->IsSMTP();
    $mail->SMTPDebug     = 0;
    $mail->SMTPAuth     = true;
    $mail->Mailer           = "smtp";
    $mail->SMTPSecure     = 'ssl';
    $mail->Host         = $mail_host;
    $mail->Port         = $mail_port;
    $mail->Username     = $mail_user;
    $mail->Password     = $mail_pswd;
    $mail->Subject         = $mail_subj;
    $mail->SetFrom($mail_user, $mail_name);

    if ($mail_main != "") {
        $mail_mainx = explode(',', $mail_main);
        foreach ($mail_mainx as $mail_maini) {
            if ($mail_maini != '') {
                $mail->AddAddress($mail_maini);
            }
        }
    }

    if ($mail_copy != "") {
        $mail_copyx = explode(',', $mail_copy);
        foreach ($mail_copyx as $mail_copyi) {
            if ($mail_copyi != '') {
                $mail->AddCC($mail_copyi);
            }
        }
    }

    if ($mail_bccy != "") {
        $mail_bccyx = explode(',', $mail_bccy);
        foreach ($mail_bccyx as $mail_bccyi) {
            if ($mail_bccyi != '') {
                $mail->AddBCC($mail_bccyi);
            }
        }
    }

    if ($mail_file != "") {
        $mail_filex = explode(',', $mail_file);
        foreach ($mail_filex as $mail_filei) {
            if ($mail_filei != '') {
                $mail->AddAttachment($mail_filei);
            }
        }
    }

    $mail->MsgHTML($mail_text);

    if ($mail->Send()) {
        $resp_stat = "T";
    } else {
        $resp_stat = "F";
        $resp_mesg = "Mail Could not be sent!" . $mail->ErrorInfo;
    }
    return $resp_stat;
}