HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/sarvodayahospital/public/services/behealthy/cancer-medical-management/send-mail.php
<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require('PHPMailer/src/Exception.php');
require('PHPMailer/src/PHPMailer.php');
require('PHPMailer/src/SMTP.php');

function sendMail($pagename = '', $name = '', $mobile = '', $email = '', $message = '')
{
    $mail = new PHPMailer;

    $mail->isSMTP(); // using SMTP protocol                                     
    $mail->Host = 'smtp3.netcore.co.in'; // SMTP host as gmail 
    $mail->SMTPAuth = true;  // enable smtp authentication                             
    $mail->Username = 'connect@sarvodayahospital.com';  // sender gmail host              
    $mail->Password = '#Way2Cloud@12!'; // sender gmail host password                          
    $mail->SMTPSecure = 'TLS';  // for encrypted connection                           
    $mail->Port = 587;   // port for SMTP    

    
    $mail->setFrom('connect@sarvodayahospital.com','Sarvodaya Hospital');


    /* Add a recipient */
    $mail->addAddress('connect@sarvodayahospital.com');
    
    
    /* Email subject */ 
    $mail->Subject = 'Inquiry From '.$pagename;
    
    /* Set email format to HTML */
    $mail->isHTML(true); 
    
    /* Email body content */
    if($pagename != null && $name != null && $mobile != null && $email != null && $message != null){
      $mailContent = "
      <h2>Lead Details- Sarvodaya <span style='color:green'>$pagename</span> Leads</h2>
      <hr style='width: 120px;height: 3px;margin-top: -0.5rem; background: green; border-radius: 5px; float: left;margin-left: 12%;'>
      <table style='width:50%;border: 1px solid black; margin-top:30px;'>
          <tr style='border: 1px solid black;'>
            <th>Page:</th>
            <td style='border: 1px solid black; padding: 5px; text-align: center;'>$pagename</td>
          </tr>
          <tr style='border: 1px solid black;'>
            <th>Name:</th>
            <td style='border: 1px solid black; padding: 5px; text-align: center;'>$name</td>
          </tr>
          <tr style='border: 1px solid black;'>
            <th>Phone:</th>
            <td style='border: 1px solid black; padding: 5px; text-align: center;'>$mobile</td> 
          </tr>
          <tr style='border: 1px solid black;'>
            <th>Email:</th>
            <td style='border: 1px solid black; padding: 5px; text-align: center;'>$email</td>
          </tr>
          <tr style='border: 1px solid black;'>
            <th>Message:</th>
            <td style='border: 1px solid black; padding: 5px; text-align: center;'>$message</td>
          </tr>
      </table><br><br>
      <a href='http://dev2.cccinfotech.com/sarvodaya/' style='text-align: center'>
      <img src='http://dev2.cccinfotech.com/sarvodaya/assets/images/sarvodaya-logoNew.png' alt='Sarvodaya Hospital Logo' style='width: 50%;
      height: auto;'></a>";
    }
    $mail->Body = $mailContent;
    
    /* Send email */
    if(!$mail->send())
    {
        echo 'Mail could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    }
    else
    {
      echo 'Mail Sent.';
      return true;
    }
  }

  // User Email id get and send mail for confirmation
  function sendUserMail($email='', $name='')
  {
    $mail = new PHPMailer;

    $mail->isSMTP(); // using SMTP protocol                                     
    $mail->Host = 'smtp3.netcore.co.in'; // SMTP host as gmail 
    $mail->SMTPAuth = true;  // enable smtp authentication                             
    $mail->Username = 'connect@sarvodayahospital.com';  // sender gmail host              
    $mail->Password = '#Way2Cloud@12!'; // sender gmail host password                          
    $mail->SMTPSecure = 'tls';  // for encrypted connection                           
    $mail->Port = 587;   // port for SMTP    

    
    $mail->setFrom('connect@sarvodayahospital.com','Sarvodaya Hospital');


    /* Add a recipient */
    $mail->addAddress($email);
    
    /* Email subject */ 
    $mail->Subject = 'Sarvodaya Hospital Inquiry Confirmation';
    
    /* Set email format to HTML */
    $mail->isHTML(true); 
    
    /* Email body content */
    if($email != null && $name != null ){
      $mailContent = "
      <h3>Dear $name ,</h3>
      <p>Thank you for reaching out to us, we appreciate your interest in Sarvodaya Hospital!
      </p>
      <p>Your inquiry is important to us, and we are dedicated to provide you with all the relevant information you need.</p>
      <p>However, If you have any additional queries, please feel free to contact at: 1800 313 1414</p>
      <p>Warm Regards.</p>
      <table>
          <tr>
            <th style='font-weight: bold; text-align: left;'>Sarvodaya Healhtcare!</th>
          </tr>
          <tr>
            <td>Email: connect@sarvodayahospital.com</td>
          </tr>
          <tr>
            <td>Toll Free: 1800 313 1414</td>
          </tr>
      </table>
      <a href='http://dev2.cccinfotech.com/sarvodaya/'><img src='assets/images/sarvodaya-logoNew.png' alt='Sarvodaya Hospital Logo' style='width: 300px;
      height: auto;'></a>";
    }
    else{
      echo 'User email id could not be find.';
    } 
    $mail->Body = $mailContent;
    
    /* Send email */
    if(!$mail->send())
    {
        echo 'Mail could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    }
    else
    {
      echo 'Mail Sent.';
      return true;
    }
  }
?>