Hi

I have a tiny problem, the emails outgoing from my website are all going to hotmail and are for some reason un-openable.
You have to click the 'This message has been blocked for your safety. Open message' in the red box at the top of the message.

I have posted a screenshot bellow.
Is it something in the code that is making it so hard to open in hotmail.

Thanks for any help.

<?php
			if (isset ($_REQUEST['go']) && $_REQUEST['go'] == true) {

$emailh = "From: Psychedelic Rhinos <reecesplace@hotmail.co.uk>\r\n";
$emailh .= "MIME-Version: 1.0\r\n";
$email = $_POST['email'];
$name = $_POST['name'];
$msg = $_POST['message'];
$message = $msg." (Email address: $email)";

$subject = $_POST['subject'];
$subjectall = $subject." | From $name";
mail("reecestanton@hotmail.co.uk", $subjectall, $message, $emailh);
	

?>
	
	<h2>Message Sent</h2>
             <p style="width:700px;">A message has been sent to the site administrator. It will be read shortly.
        </p> 
        </p> <a href="contact.php">Go back</a><br /><img src="images/tick.png" />
    <?php
			}
			else {
			?>
            
            
            
             <h2>Contact Us</h2>
             <p style="width:700px;">If you need to get in touch with the Rhinos urgently then <u>call 07958 964643</u> however if its more of a relaxed matter feel free to give us an email. Whether its about the website or even about training times, were always happy to help.
        </p> 
        <br />
        <form action="contact.php?go=true" method="post">
Name : <input type="text" name="name" style="margin-left:9px;" /><br /><br />
Subject : <input type="text" name="subject" /><br /><br />
Email : <input type="text" name="email" style="margin-left:12px;" /><br /><br />Message:<br /><br />
 <textarea name="message"></textarea>
             <br />
             <input type="image" src="images/arrow.png"  />
             <br /><br />
             
            </form>
          <?php }; ?>

Recommended Answers

All 6 Replies

Try making the From header address different from the To address. That can sometimes increase the chances of the message being spam.

Sorry I dont really understand what you mean.
Could you show me ?

An example of what you did in short is as follows:

mail("reecestanton@hotmail.co.uk", $subjectall, $message, "From: Psychedelic Rhinos <reecesplace@hotmail.co.uk>");

And an example of what you need to do in short is as follows:

mail("reecestanton@hotmail.co.uk", $subjectall, $message, "From: Sombody else <different_valid_email@hotmail.co.uk>");

Most modern mailcenters use highly advanced filters. They can find out the domain that the email was sent from and as it is a H-o-t-m-a-i-l (Sorry, school pr-o-xy blocks) address in the from field they would be able to tell that the message did not come from their own servers. It is best to have the email coming from your SMTP domain to ensure your message is marked safe so if your SMTP is at smtp.mydomain.com you email address would need to be some_address@mydomain.com. If you use your ISP's SMTP then it would need to come from their domain E.G. I use Virgin Media's SMTP server so my emails come from samaruge@virgin.net
Some servers will block your message completely in a case like this.

Try clicking on the 'learn more', it may tell you more about why it is being blocked.

It could also be because you're sending an HTML form in the email. You should probably only send a link to a form on your site.

Adding a plain text version should also give an alternative for those email clients that do not like the HTML message, or do not support HTML.

You'll also notice that the form action is relative.

<form action="contact.php?go=true" method="post">

This could be interpreted at an XSS attack on hotmail. It should be the full URL of your site. As it is it points to contact.php on the hotmail domain.

The easiest thing to do would be

<form action="<?php
echo "http://".$_SERVER['HTTP_HOST']."/contact.php?go=true";
?>" method="post">

Then the form would always be the site that was being accessed

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.