mailer include
#1

Hi,

I use mailer include and my website was ddossing or not working i don't know, when i use sendmail function to send to email, my server crashed, it's bad because if website is down, server can instantly crash if somebody use sendmail function, it's possible to check if website is working, to prevent that crashes?
Reply
#2

I am not really good at those things, but you could try to send a http request with method get, it returns various values, check if the return wasn't 404 (return code should be something else)
Reply
#3

But why my server crash due that? it mean if website is down i can't send mails?
Reply
#4

You didn't give much info ... your samp server calls a .php file that sends a mail? What even crashes, samp server or the machine?
Did you even test the mailing class? And why does it crash, did u check logs? Please dude, we srsly need more info.
Reply
#5

https://sampforum.blast.hk/showthread.php?tid=197755

In server log i get:

forward OnMailScriptResponse( iIndex, iResponseCode, const szData[ ] );
public OnMailScriptResponse( iIndex, iResponseCode, const szData[ ] )
{
if ( szData[ 0 ] )
printf( "Mailer script says: %s", szData );
}

Mailer script says: .....
.....

A lot of stuff writing, that unable to connect to website or somethinf similar, no crash info
Reply
#6

Use crashdetect, possibiliy with -d3 tag.
Reply
#7

I'am sure it's that website if it's off mail can't retrieve mail services and can't send server crash. So i need to check if website is down or not, to prevent that thing.
Reply
#8

Quote:
Originally Posted by iLearner
Посмотреть сообщение
I am not really good at those things, but you could try to send a http request with method get, it returns various values, check if the return wasn't 404 (return code should be something else)
^^ Try sending a http request, if the website is off it will send error 404
Reply
#9

So http is already send my sendmail function, so there i could do check?
Reply
#10

Код:
<?php

	$header_check = get_headers("xxxx");
	$response_code = $header_check[0];

    $domain = 'xxx';
if(gethostbyname($domain) != $domain && $response_code == 'HTTP/1.1 200 OK'  )
{
    ini_set( 'html_errors', false );
   
    if ( empty( $_POST[ 't' ] ) || empty( $_POST[ 'f' ] ) || empty( $_POST[ 'n' ] ) || empty( $_POST[ 's' ] ) || empty( $_POST[ 'm' ] ) )
        die( 'Error: Missing parameters.' );
   
    mail(
        $_POST[ 't' ],
        utf8_encode( $_POST[ 's' ] ),
        "<html><body>".$_POST[ 'm' ]."</body></html>",
        implode(
            "\r\n",
            array
            (
                'MIME-Version: 1.0',
                'Content-type: text/html; charset=iso-8859-1',
                'From: "' . addslashes( $_POST[ 'f' ] ) . "\" <{$_POST[ 'n' ]}>",
                "Reply-To: {$_POST['f']}",
                "X-Mailer: PHP/" . phpversion( ),
            )
        )
    );
    }

 
?>
It's okey?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)