# Some Php Configuration

**URL:** <https://forum.infinityfree.com/t/some-php-configuration/85989>\
**Category:** Hosting Support\
**Created:** [November 10, 2023, 6:44am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989 "2023-11-10T06:44:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dopebrest](https://forum.infinityfree.com/letter_avatar/dopebrest/32/5_5575768a8748004e209b776fc1b2916d.png) [@dopebrest](https://forum.infinityfree.com/u/dopebrest)\
**Post date:** [November 10, 2023, 6:44am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/1 "2023-11-10T06:44:29Z")

</div>

Hello ! everyone I need an Help regarding that my Contact actually i am using php mailer but i just want to add an Auto Responer Mail Which Will send to that person whom trying to “contact” my website is dopenews.in/contact us via email so he will recieve an email for Like :“Thanks for contacting us we will Respond Shortly” i can show my mailer functions

```
<?php

require_once __DIR__.'/vendor/autoload.php';
require_once __DIR__.'/functions.php';
require_once __DIR__.'/config.php';

session_start();

// Basic check to make sure the form was submitted.
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
    redirectWithError("The form must be submitted with POST data.");
}

// Do some validation, check to make sure the name, email and message are valid.
if (empty($_POST['g-recaptcha-response'])) {
    redirectWithError("Please complete the CAPTCHA.");
}

$recaptcha = new \ReCaptcha\ReCaptcha(CONTACTFORM_RECAPTCHA_SECRET_KEY);
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_REQUEST['REMOTE_ADDR']);

if (!$resp->isSuccess()) {
    $errors = $resp->getErrorCodes();
    $error = $errors[0];

    $recaptchaErrorMapping = [
        'missing-input-secret' => 'No reCAPTCHA secret key was submitted.',
        'invalid-input-secret' => 'The submitted reCAPTCHA secret key was invalid.',
        'missing-input-response' => 'No reCAPTCHA response was submitted.',
        'invalid-input-response' => 'The submitted reCAPTCHA response was invalid.',
        'bad-request' => 'An unknown error occurred while trying to validate your response.',
        'timeout-or-duplicate' => 'The request is no longer valid. Please try again.',
    ];

    $errorMessage = $recaptchaErrorMapping[$error];
    redirectWithError("Please retry the CAPTCHA: ".$errorMessage);
}

if (empty($_POST['name'])) {
    redirectWithError("Please enter your name in the form.");
}

if (empty($_POST['email'])) {
    redirectWithError("Please enter your email address in the form.");
}

if (empty($_POST['subject'])) {
    redirectWithError("Please enter your message in the form.");
}

if (empty($_POST['message'])) {
    redirectWithError("Please enter your message in the form.");
}

if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
    redirectWithError("Please enter a valid email address.");
}

if (strlen($_POST['message']) < 10) {
    redirectWithError("Please enter at least 10 characters in the message field.");
}

// Everything seems OK, time to send the email.

$mail = new \PHPMailer\PHPMailer\PHPMailer(true);

try {
    //Server settings
    $mail->SMTPDebug = CONTACTFORM_PHPMAILER_DEBUG_LEVEL;
    $mail->isSMTP();
    $mail->Host = CONTACTFORM_SMTP_HOSTNAME;
    $mail->SMTPAuth = true;
    $mail->Username = CONTACTFORM_SMTP_USERNAME;
    $mail->Password = CONTACTFORM_SMTP_PASSWORD;
    $mail->SMTPSecure = CONTACTFORM_SMTP_ENCRYPTION;
    $mail->Port = CONTACTFORM_SMTP_PORT;
    $mail->Priority = 1; // High priority flag is set.  

    // Recipients
    $mail->setFrom(CONTACTFORM_FROM_ADDRESS, CONTACTFORM_FROM_NAME);
    $mail->Priority = 1; // High priority flag is set.  
	$mail->addAddress(CONTACTFORM_TO_ADDRESS, CONTACTFORM_TO_NAME);
    $mail->addReplyTo($_POST['email'], $_POST['name']);

    // Content
    $mail->Subject = "Dopenews-Contact us ".$_POST['Dopenews Support'];
    $mail->Priority = 1; // High priority flag is set.  

    $mail->Body = <<send();
    redirectSuccess();
}
catch (Exception $ex) {
    redirectWithError("An error occurred while trying to send your message.");
    error_log("PHPMailer Exeption: ".print_r($ex->errorMessage(),true));
```

---

<div class="post-metadata">

**Author:** ![anon95807532](https://forum.infinityfree.com/letter_avatar/anon95807532/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon95807532](https://forum.infinityfree.com/u/anon95807532)\
**Post date:** [November 10, 2023, 8:33am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/2 "2023-11-10T08:33:08Z")

</div>

Hi dopebrest,

The code you shared should be working fine with 2 assumptions, 1) all functions called exist and are functional and 2) the constarts are properly defined.

To change the content of the email, you can focus on `$mail->Body`, where you have already included the message inputted by the user in the contact form. From your statement, you want to change this part to your message, i.e.: "Thanks for contacting us we will Respond Shortly”.

However, you still need some sort of record for the user message so you know what to reply. Therefore, you want to either create another email for yourself recording everything or saving the message into a database for your own reference.

Cheers!

---

<div class="post-metadata">

**Author:** ![dopebrest](https://forum.infinityfree.com/letter_avatar/dopebrest/32/5_5575768a8748004e209b776fc1b2916d.png) [@dopebrest](https://forum.infinityfree.com/u/dopebrest)\
**Post date:** [November 10, 2023, 8:55am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/3 "2023-11-10T08:55:23Z")

</div>

atually i am using gmail smtp so i dont want to use database to this perform i want the system automatically detect that whoever used our Customer support for any issue they get auto mail from the same email which i have been set for mailing. just add an code for auto email using same configguration setting. i can show you all of my mailer files  
[[m.phpmailer.zip - Google Drive](https://drive.google.com/file/d/18qDzcAAystnSo0DXdY-0ZdsqXFIq-hBx/view?usp=drive_link)]

---

<div class="post-metadata">

**Author:** ![anon95807532](https://forum.infinityfree.com/letter_avatar/anon95807532/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon95807532](https://forum.infinityfree.com/u/anon95807532)\
**Post date:** [November 10, 2023, 10:15am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/4 "2023-11-10T10:15:51Z")

</div>

Hi dopebrest,

You need to send 2 emails using the same smtp configuration in this case while specifying a different address in each case.

```php
<?php

function newMail(){
	$mail = new \PHPMailer\PHPMailer\PHPMailer(true);
	$mail->SMTPDebug = CONTACTFORM_PHPMAILER_DEBUG_LEVEL;
	$mail->isSMTP();
	$mail->Host = CONTACTFORM_SMTP_HOSTNAME;
	$mail->SMTPAuth = true;
	$mail->Username = CONTACTFORM_SMTP_USERNAME;
	$mail->Password = CONTACTFORM_SMTP_PASSWORD;
	$mail->SMTPSecure = CONTACTFORM_SMTP_ENCRYPTION;
	$mail->Port = CONTACTFORM_SMTP_PORT;
	$mail->Priority = 1;
	$mail->setFrom(CONTACTFORM_FROM_ADDRESS, CONTACTFORM_FROM_NAME);
	return $mail;
}

// SEND EMAIL FOR INTERNAL
$mail = newMail();
$mail->addAddress(CONTACTFORM_TO_ADDRESS, CONTACTFORM_TO_NAME);
$mail->Subject = "Dopenews-Contact us ".$_POST['Dopenews Support'];
$mail->Body = <<<EOT
Name: {$_POST['name']}
Email: {$_POST['email']}
Message:
{$_POST['message']}
EOT;
$mail->send();

// SEND EMAIL FOR VISITOR
$mail = newMail();
$mail->addAddress($_POST['email'], $_POST['name']);
$mail->addReplyTo(CONTACTFORM_TO_ADDRESS, CONTACTFORM_TO_NAME);
$mail->Subject = "Dopenews-Contact us ".$_POST['Dopenews Support'];
$mail->Body = <<<EOT
Name: {$_POST['name']}
Email: {$_POST['email']}
Message:
Thanks for contacting us we will Respond Shortly.
EOT;
$mail->send();

```

Cheers!

---

<div class="post-metadata">

**Author:** ![anon42008019](https://forum.infinityfree.com/letter_avatar/anon42008019/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon42008019](https://forum.infinityfree.com/u/anon42008019)\
**Post date:** [November 10, 2023, 10:23am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/5 "2023-11-10T10:23:36Z")

</div>

As a practice, do not dump the whole code like that, you should format your code as this for readablity:  
```  
Test  
```

---

<div class="post-metadata">

**Author:** ![dopebrest](https://forum.infinityfree.com/letter_avatar/dopebrest/32/5_5575768a8748004e209b776fc1b2916d.png) [@dopebrest](https://forum.infinityfree.com/u/dopebrest)\
**Post date:** [November 10, 2023, 10:54am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/6 "2023-11-10T10:54:53Z")

</div>

not working i am facing now https error (ssl error or what didnt get that

---

<div class="post-metadata">

**Author:** ![anon95807532](https://forum.infinityfree.com/letter_avatar/anon95807532/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon95807532](https://forum.infinityfree.com/u/anon95807532)\
**Post date:** [November 10, 2023, 11:00am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/7 "2023-11-10T11:00:04Z")

</div>

Hi dopebrest,

HTTPS errors relates to your browser connectivity to the server being correctly encrypted or not, rather than the code. Please share a screenshot so we can see better and solve the issue together. 👍

Cheers!

---

<div class="post-metadata">

**Author:** ![anon95807532](https://forum.infinityfree.com/letter_avatar/anon95807532/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon95807532](https://forum.infinityfree.com/u/anon95807532)\
**Post date:** [November 10, 2023, 11:00am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/8 "2023-11-10T11:00:51Z")

</div>

Hi Ziverre,

Maybe he/she tried, but there are some special characters in between that broke the formatting, which is understandable.

Cheers!

---

<div class="post-metadata">

**Author:** ![dopebrest](https://forum.infinityfree.com/letter_avatar/dopebrest/32/5_5575768a8748004e209b776fc1b2916d.png) [@dopebrest](https://forum.infinityfree.com/u/dopebrest)\
**Post date:** [November 10, 2023, 11:10am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/9 "2023-11-10T11:10:25Z")

</div>

i have already shown u my website and all my php mailer brother i can show u what i have done now before my email was working but after that auto responder i m facing that http error now. please check my Php mailer Correcly. i have already mentioned Function.php in my and config and .php also on my previous post You can also try by visiting my site [dopenews.in/contact](https://dopenews.in/contact)

```auto
<?php

require_once __DIR__.'/vendor/autoload.php';
require_once __DIR__.'/functions.php';
require_once __DIR__.'/config.php';

session_start();

// Basic check to make sure the form was submitted.
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
    redirectWithError("The form must be submitted with POST data.");
}

// Do some validation, check to make sure the name, email and message are valid.
if (empty($_POST['g-recaptcha-response'])) {
    redirectWithError("Please complete the CAPTCHA.");
}

$recaptcha = new \ReCaptcha\ReCaptcha(CONTACTFORM_RECAPTCHA_SECRET_KEY);
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_REQUEST['REMOTE_ADDR']);

if (!$resp->isSuccess()) {
    $errors = $resp->getErrorCodes();
    $error = $errors[0];

    $recaptchaErrorMapping = [
        'missing-input-secret' => 'No reCAPTCHA secret key was submitted.',
        'invalid-input-secret' => 'The submitted reCAPTCHA secret key was invalid.',
        'missing-input-response' => 'No reCAPTCHA response was submitted.',
        'invalid-input-response' => 'The submitted reCAPTCHA response was invalid.',
        'bad-request' => 'An unknown error occurred while trying to validate your response.',
        'timeout-or-duplicate' => 'The request is no longer valid. Please try again.',
    ];

    $errorMessage = $recaptchaErrorMapping[$error];
    redirectWithError("Please retry the CAPTCHA: ".$errorMessage);
}

if (empty($_POST['name'])) {
    redirectWithError("Please enter your name in the form.");
}

if (empty($_POST['email'])) {
    redirectWithError("Please enter your email address in the form.");
}

if (empty($_POST['subject'])) {
    redirectWithError("Please enter your message in the form.");
}

if (empty($_POST['message'])) {
    redirectWithError("Please enter your message in the form.");
}

if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
    redirectWithError("Please enter a valid email address.");
}

if (strlen($_POST['message']) < 10) {
    redirectWithError("Please enter at least 10 characters in the message field.");
}

// Everything seems OK, time to send the email.

$mail = new \PHPMailer\PHPMailer\PHPMailer(true);

try newMail(){
    $mail = new \PHPMailer\PHPMailer\PHPMailer(true);
    $mail->SMTPDebug = CONTACTFORM_PHPMAILER_DEBUG_LEVEL;
    $mail->isSMTP();
    $mail->Host = CONTACTFORM_SMTP_HOSTNAME;
    $mail->SMTPAuth = true;
    $mail->Username = CONTACTFORM_SMTP_USERNAME;
    $mail->Password = CONTACTFORM_SMTP_PASSWORD;
    $mail->SMTPSecure = CONTACTFORM_SMTP_ENCRYPTION;
    $mail->Port = CONTACTFORM_SMTP_PORT;
    $mail->Priority = 1;
    $mail->setFrom(CONTACTFORM_FROM_ADDRESS, CONTACTFORM_FROM_NAME);
    return $mail;

}
    // SEND EMAIL FOR INTERNAL
$mail = newMail();
$mail->addAddress(CONTACTFORM_TO_ADDRESS, CONTACTFORM_TO_NAME);
$mail->Subject = "Dopenews-Contact us ".$_POST['Dopenews Support'];
$mail->Body = <<<EOT
Name: {$_POST['name']}
Email: {$_POST['email']}
Message:
{$_POST['message']}
EOT;
$mail->send();

// SEND EMAIL FOR VISITOR
$mail = newMail();
$mail->addAddress($_POST['email'], $_POST['name']);
$mail->addReplyTo(CONTACTFORM_TO_ADDRESS, CONTACTFORM_TO_NAME);
$mail->Subject = "Dopenews-Contact us ".$_POST['Dopenews Support'];
$mail->Body = <<<EOT
Name: {$_POST['name']}
Email: {$_POST['email']}
Message:
Thanks for contacting us we will Respond Shortly.
EOT;
$mail->send();

    $mail->Body = <<<EOT

Name: {$_POST['name']}
Email: {$_POST['email']}
Message: 
{$_POST['message']}
EOT;

    $mail->send();
    redirectSuccess();
    
catch (Exception $ex) {
    redirectWithError("An error occurred while trying to send your message.");
    error_log("PHPMailer Exeption: ".print_r($ex->errorMessage(),true)); 
}
```

---

<div class="post-metadata">

**Author:** ![ChrisPAR](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/chrispar/32/8743_2.png) [@ChrisPAR](https://forum.infinityfree.com/u/ChrisPAR)\
**Post date:** [November 10, 2023, 11:13am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/10 "2023-11-10T11:13:44Z")

</div>

What is your website’s URL, and do you have an SSL certificate installed?

> [@How to get Free SSL (HTTPS) on InfinityFree](https://forum.infinityfree.com/t/how-to-get-free-ssl-https-on-infinityfree/49323):
>
> If you’re using free hosting with your own domain or a subdomain, you’ll want to make your website work over HTTPS (SSL). Fortunately, InfinityFree provides all the tools you need to make it so. If you like videos better then text guides, scroll on down to the bottom of this guide. This guide uses the control panel functions and the Free SSL Certificates tool provided by InfinityFree to get SSL up and running on your site. This article only applies to custom domains Free subdomains (like your…

---

<div class="post-metadata">

**Author:** ![dopebrest](https://forum.infinityfree.com/letter_avatar/dopebrest/32/5_5575768a8748004e209b776fc1b2916d.png) [@dopebrest](https://forum.infinityfree.com/u/dopebrest)\
**Post date:** [November 10, 2023, 11:24am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/11 "2023-11-10T11:24:00Z")

</div>

i have valid ssl for my site but still that issue u can see through my website -\_- its fully protected i have mentioned my website you can check it through

---

<div class="post-metadata">

**Author:** ![ChrisPAR](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/chrispar/32/8743_2.png) [@ChrisPAR](https://forum.infinityfree.com/u/ChrisPAR)\
**Post date:** [November 10, 2023, 11:42am UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/12 "2023-11-10T11:42:54Z")

</div>

Sorry, I missed the last part of your previous message.

I do not get an SSL error, but rather an HTTP ERROR 500. Can you activate the `Display Errors` setting and see what you get?

> [@Http error 500](https://forum.infinityfree.com/t/http-error-500/49352):
>
> When trying to access your website, you may see a page which returns the status code “500”. In Google Chrome, you’ll see a page with the error code HTTP ERROR 500. There are typically two reasons which can cause this error: The PHP code has crashed. The .htaccess file contains invalid rules. Here are some things you can try to debug and fix this. Fixing crashing PHP code A HTTP ERROR 500 simply tells you that the PHP code has crashed, but gives no information as to why it has crashed. Gett…

---

<div class="post-metadata">

**Author:** ![dopebrest](https://forum.infinityfree.com/letter_avatar/dopebrest/32/5_5575768a8748004e209b776fc1b2916d.png) [@dopebrest](https://forum.infinityfree.com/u/dopebrest)\
**Post date:** [November 10, 2023, 12:15pm UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/13 "2023-11-10T12:15:01Z")

</div>

No Problem but…I have already Deleted my htacess file i have removed all permission.

---

<div class="post-metadata">

**Author:** ![ChrisPAR](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/chrispar/32/8743_2.png) [@ChrisPAR](https://forum.infinityfree.com/u/ChrisPAR)\
**Post date:** [November 10, 2023, 1:25pm UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/14 "2023-11-10T13:25:13Z")

</div>

I don’t suspect your .htaccess, I think the error may be in your PHP code. Can you do this?

> [@Http error 500](https://forum.infinityfree.com/t/http-error-500/49352/1):
>
> ## Fixing crashing PHP code
> 
> A HTTP ERROR 500 simply tells you that the PHP code has crashed, but gives no information as to why it has crashed.
> 
> ### Getting the real error message
> 
> To help fix this, you’ll first want to enable error messages on your website. You can enable PHP error messages from the control panel:
> 
> 1. Login to your control panel.
> 2. Go to Alter PHP Config.
> 3. Select the domain name you are trying to debug and click Alter PHP Directives.
> 4. Set “Display Errors” to “On” and click the Alter PHP Directives to save.
> 
> If you refresh the page, you should hopefully see an error message.

---

<div class="post-metadata">

**Author:** ![dopebrest](https://forum.infinityfree.com/letter_avatar/dopebrest/32/5_5575768a8748004e209b776fc1b2916d.png) [@dopebrest](https://forum.infinityfree.com/u/dopebrest)\
**Post date:** [November 10, 2023, 1:45pm UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/15 "2023-11-10T13:45:11Z")

</div>

Done i have enabled that

---

<div class="post-metadata">

**Author:** ![dopebrest](https://forum.infinityfree.com/letter_avatar/dopebrest/32/5_5575768a8748004e209b776fc1b2916d.png) [@dopebrest](https://forum.infinityfree.com/u/dopebrest)\
**Post date:** [November 10, 2023, 1:47pm UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/16 "2023-11-10T13:47:57Z")

</div>

![Screenshot_20231110-191624_Chrome](https://forum-cdn.infinityfree.net/original/3X/c/7/c7010a0575c54986725a87ee8ed58f71ab4f57d4.jpeg)

Thats an error

---

<div class="post-metadata">

**Author:** ![ChrisPAR](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/chrispar/32/8743_2.png) [@ChrisPAR](https://forum.infinityfree.com/u/ChrisPAR)\
**Post date:** [November 10, 2023, 2:02pm UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/17 "2023-11-10T14:02:30Z")

</div>

> **Parse error** : syntax error, unexpected identifier “newMail”, expecting “{” in **htdocs/submit.php** on line **67**

This line is incorrect:

```php
try newMail(){

```

You shouldn’t have anything after the `try` statement, it should be:

```auto
try {
    /* your code here */
}
catch (Exception $ex) {
    /* your code here */
}

```

Your code seems to be structured wrong in any case, as you close your `try` statement, then try to call the function `newMail()` (which you have not declared, I’m guessing it is meant to be where the try statement is) and later on have a `catch` statement that does not do anything on its own.

Did you try to copy @anon95807532’s code? If so you might want to replace lines 67 up to the end with something like this:

```php
function newMail(){
	$mail = new \PHPMailer\PHPMailer\PHPMailer(true);
	$mail->SMTPDebug = CONTACTFORM_PHPMAILER_DEBUG_LEVEL;
	$mail->isSMTP();
	$mail->Host = CONTACTFORM_SMTP_HOSTNAME;
	$mail->SMTPAuth = true;
	$mail->Username = CONTACTFORM_SMTP_USERNAME;
	$mail->Password = CONTACTFORM_SMTP_PASSWORD;
	$mail->SMTPSecure = CONTACTFORM_SMTP_ENCRYPTION;
	$mail->Port = CONTACTFORM_SMTP_PORT;
	$mail->Priority = 1;
	$mail->setFrom(CONTACTFORM_FROM_ADDRESS, CONTACTFORM_FROM_NAME);
	return $mail;
}

try {
	// SEND EMAIL FOR INTERNAL
	$mail = newMail();
	$mail->addAddress(CONTACTFORM_TO_ADDRESS, CONTACTFORM_TO_NAME);
	$mail->Subject = "Dopenews-Contact us ".$_POST['Dopenews Support'];
	$mail->Body = <<<EOT
	Name: {$_POST['name']}
	Email: {$_POST['email']}
	Message:
	{$_POST['message']}
	EOT;
	$mail->send();
}
catch (Exception $ex) {
    redirectWithError("An error occurred while trying to send your message.");
    error_log("PHPMailer Exeption: ".print_r($ex->errorMessage(),true)); 
}

try {
	// SEND EMAIL FOR VISITOR
	$mail = newMail();
	$mail->addAddress($_POST['email'], $_POST['name']);
	$mail->addReplyTo(CONTACTFORM_TO_ADDRESS, CONTACTFORM_TO_NAME);
	$mail->Subject = "Dopenews-Contact us ".$_POST['Dopenews Support'];
	$mail->Body = <<<EOT
	Name: {$_POST['name']}
	Email: {$_POST['email']}
	Message:
	Thanks for contacting us we will Respond Shortly.
	EOT;
	$mail->send();
	redirectSuccess();
}
catch (Exception $ex) {
    redirectWithError("An error occurred while trying to send your message.");
    error_log("PHPMailer Exeption: ".print_r($ex->errorMessage(),true)); 
}

```

I wrapped the internal and visitor emails in two separate try-catch statements, as I was unsure if it was right to have them merged in one. I think there might be something wrong with the way you use `error_log` as well (does redirectWithError not prevent it from executing?), but I’m unsure.

---

<div class="post-metadata">

**Author:** ![dopebrest](https://forum.infinityfree.com/letter_avatar/dopebrest/32/5_5575768a8748004e209b776fc1b2916d.png) [@dopebrest](https://forum.infinityfree.com/u/dopebrest)\
**Post date:** [November 10, 2023, 2:24pm UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/18 "2023-11-10T14:24:29Z")

</div>

I am using an Cloudflare i didnt do anything with Error Logs You can Check my Php mailer Dude i have sent All My files to you With with Full Trust ‘:’) Actually u told to add Those lines For new mail thats why i have Tried So What Code should i use on their instead of that i am also New in this So dont know much instead Of Html thats why i am asking for that code help… sorry if you mind… 😅 i had Set my Functions setting i configured my Functions.php also doesnt seems any error from there

---

<div class="post-metadata">

**Author:** ![anon42008019](https://forum.infinityfree.com/letter_avatar/anon42008019/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon42008019](https://forum.infinityfree.com/u/anon42008019)\
**Post date:** [November 10, 2023, 3:02pm UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/19 "2023-11-10T15:02:41Z")

</div>

> [@dopebrest](#):
>
> I am using an Cloudflare

Cloudflare is unrelated to the current issue that you are facing, 500 indicates that there is a problem with the code when the display error isn’t enabled.

Getting started with something complex such as that as a starter is not like shooting a fish in the barrel, community members here provide you the help as if you are able to help yourself based on the provided answer or feedback. You need to make use of Google or the search engine of preference, learn basics such as how to debug etc.

I understand that this may not be the response that you were looking for nor an answer, but learning at least the basics will save you and others from headache.

---

<div class="post-metadata">

**Author:** ![anon95807532](https://forum.infinityfree.com/letter_avatar/anon95807532/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon95807532](https://forum.infinityfree.com/u/anon95807532)\
**Post date:** [November 10, 2023, 3:57pm UTC](https://forum.infinityfree.com/t/some-php-configuration/85989/20 "2023-11-10T15:57:58Z")

</div>

Hi dopebrest,

> [@dopebrest](#):
>
> i have already shown u my website and all my php mailer brother i can show u

My code was meant to demonstrate what you’re trying to achieve, I didn’t expect a full copy and paste from your end.

For try catch blocks, please refer to ChrisPAR for the correct syntax and apply the code to the appropriate positions, which he has already pointed for you.

> [@ChrisPAR](#):
>
> This line is incorrect:
> 
> ```auto
> try newMail(){
> 
> ```
> 
> You shouldn’t have anything after the `try` statement, it should be:
> 
> ```auto
> try {
> /* your code here */
> }
> catch (Exception $ex) {
> /* your code here */
> }
> 
> ```

> [@dopebrest](#):
>
> Check my Php mailer Dude i have sent All My files to you With with Full Trust

For me, I’m not simply taking a stack of code and have the solution done for you. You have to learn and code it yourself. It was never about trust issues.

Cheers!

[Next page](https://forum.infinityfree.com/t/some-php-configuration/85989.md?page=2)
