currenty work out some issues i have on a server. I need to check the basic mail functions... i have issues here
by the way and on a sidenote: i also checked some things in the php.ini: The php.ini has smtp_port = 25 set
but this function - we do not need for our checks... at the moment. .
below some of the tests - / note i tested some scripts -... all of them see below - with the results
mailtest10.php: Test-results: email sent - but no mail received at my inbox
taken from: https://conetix.com.au/support/simple-php-mail-test/
Code: Select all
<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "My_testmai_adress_@mywebserver.com";
$to = "My_testmai_adress_@mywebserver.com";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
echo "Test email sent";
?>
<<<<<<<<<<<<<<<<<<
mailtest20.php: Test-results: Error: Message not accepted
taken from: https://www.arclab.com/en/kb/php/how-to ... ction.html
Code: Select all
<?PHP
$sender = 'My_testmai_adress_@mywebserver.com';
$recipient = 'My_testmai_adress_@mywebserver.com';
$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;
if (mail($recipient, $subject, $message, $headers))
{
echo "Message accepted";
}
else
{
echo "Error: Message not accepted";
}
?>
<<<<<<<<<<<
mailtest30.php: Test-results: Testing PHP mail - this text was shown up
taken from: https://tekeye.uk/html/php-mail-script- ... il-sending
Code: Select all
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>PHP Mail Test</title>
</head>
<body>
<h1>Testing PHP mail</h1>
<?php
//Use your test email address
$to = 'My_testmai_adress_@mywebserver.com';
//Use an appropriate email subject
$subject = 'A Test Email';
$message = 'The quick brown fox jumped over the lazy dog. Then the fox jumped over the dog again.';
//wordwrap long content
$message = wordwrap($message, 70, "\r\n");
$headers = 'From: some.body@example.com';
//Send the email
if(mail($to, $subject, $message, $headers))
{
echo 'Email sent out';
}
else
{
echo '<pre>';
print_r(error_get_last());
echo '</pre>';
}
?>
</body>
</html>
<<<<<<<<<
mailtest40.php:Test-results: access denied-this text was shown up
taken form here: https://stackoverflow.com/questions/246 ... -of-e-mail
Code: Select all
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: yoursite.com';
$to = 'My_testmai_adress_@mywebserver.com';
$subject = 'Customer Inquiry';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html\r\n";
$headers .= 'From: from@example.com' . "\r\n" .
'Reply-To: reply@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
mailtest50.php: Test-results: access denied-this text was shown up!
taken from: https://stackoverflow.com/questions/388 ... is-enabled
Code: Select all
<?php
$email = "My_testmai_adress_@mywebserver.com";
$subject = "Email Test";
$message = "this is a mail testing email function on server";
$sendMail = mail($email, $subject, $message);
if($sendMail)
{
echo "Email Sent Successfully";
}
else
{
echo "Mail Failed";
}
?>
Well - now i will have a closer look at the server-conditions.
btw - besides the various scripts i found some other ressoruces that cover the topic-mail-deliverability and sending mails from a server: here i found a with explanaitions
https://stackoverflow.com/questions/246 ... -of-e-mail
interesting points here are some of the following:
Make sure mail headers have no syntax errors
Enable PHP's custom mail.log
See http://php.net/manual/en/mail.configuration.php for details. (It's best to enable these options in the php.ini or .user.ini or .htaccess perhaps.)
Make sure your form action value points to the correct location[/quote]
see more here: https://stackoverflow.com/questions/246 ... -of-e-mail
Look forward to hear from you..
regards