Hello world,

I have a problem with sending email in PHP. I was sending many times with the same code, but now it doesn’t work and don’t know why. I’ve contacted with domain helpdesk, but they said that there are all OK and PHP server works properly. Please someone could help me on this issue?

Here is the code
<code>
<?php
// mltiples recipientes
$para = 'arsen@khaarsen.com' . ', '; // note la coma
$para .= 'arsench@khaarsen.com';

// asunto
$asunto = 'Cursos online PGE S.L.';

// mensaje
$mensaje = '
here is the message body

';

// Para enviar correo HTML, la cabecera Content-type debe definirse
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// header
$headers .= 'To: Arsen <arsench2000@gmail.com>' . "\r\n";
$headers = 'From: Cursos online PGE S.L. <noresponder@ginerllinares.com>' . "\r\n"; // this email exists and work

// send
mail($para, $asunto, $mensaje, $headers);
echo"Message sent to <br> $para <br>";
?>
</code>

Recommended Answers

All 5 Replies

Try adding the line

ini_set('display_errors', 1);

(This turns on error reporting)
and see what errors you get back

Hello, Thank

You a lot, I’ve added , but no errors was displayed :(

Anyway thank you again.

OK then try changing this code

// send
mail($para, $asunto, $mensaje, $headers);
echo"Message sent to <br> $para <br>";
?>

to

// send
if ( !mail($para, $asunto, $mensaje, $headers) ) {
echo "An error occurred, your message was not sent";
} else {
echo"Message sent to <br> $para <br>";
}
?>

If you are still getting "Message sent to..." in your output then the PHP is fine and it could be a problem with the person you are trying to send the email to, the mail server or something else on the server.

Thank you again, I’ve tried all the possible options, but its not resolving my issue, I think the best way to change the domain host provider, because from my own web server I can send the message with the same code.

Good day!

Email messages may have one or more attachments. Attachments serve the purpose of delivering binary or text files of unspecified size. In principle there is no technical intrinsic restriction in the SMTP protocol limiting the size or number of attachments. In practice, however, email service providers implement various limitations on the permissible size of files or the size of an entire message.Furthermore, due to technical reasons, often a small attachment can increase in size when sent,which can be confusing to senders when trying to assess whether they can or cannot send a file by email, and this can result in their message being rejected bulk email marketing a broadcast email software free is really a cost-effective method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.