I use this form code for years without problem. The entire code works, every tag is ok, but if I put any tag on it it just shows me a failure message. The tag can be empty and will still stop the mail function (on php).
It took me a while until I figured out which tag was messing, I am 100% sure that is the img tag (when I just remove it the code works), the question is.. why?
Here is my code:
<?php if (isset($_POST['BTEnvia'])){
$email_remetente = "youremail@youremail.com"; // SENDER (MUST BE A EMAIL FROM THE SAME DOMAIN AS YOUR SERVER)
$email_destinatario = "youremail@youremail.com"; // RECEIVER (ANY EMAIL CAN RECEIVE IT)
$email_reply = "$email";
$email_assunto = "!!! SUBJECT !!!";
$nome = $_POST['nomea'];
// IMAGE BELOW ON THE SECOND LINE
$email_conteudo = "<html><head></head><body><table cellpadding='5' cellspacing='0' width='100%' border='1'>";
$email_conteudo .= "<tr height='50' align='center'><td><img src='http://fullpathofimagehere.jpg'></td><td><h1 style='text-align:center;'>ABERTURA DE CRÉDITO</h1> </td></tr>"; //IMG TAG IS ON THIS LINE
$email_conteudo .= "<tr height='50' align='center' width='100%' border='1'><td>Nome</td><td> $nome </td></tr>";
$email_conteudo .= "</table></body></html>";
// HEADERS
$email_headers = implode ( "
",array ( "From: $email_remetente", "Reply-To: $email_reply", "Subject: $email_assunto","Return-Path: $email_remetente","MIME-Version: 1.0","X-Priority: 3","Content-Type: text/html; charset=UTF-8" ) );
if (mail ($email_destinatario, $email_assunto, $email_conteudo, $email_headers)){
echo "Success";
}
else{
echo "<b>Fail!</b>";
}
}
?>
And here is the html code if you want to test it for yourself, just put everything on the same file and save as a .php
<form action="<? $PHP_SELF; ?>" method="POST">
<input type="text" placeholder="Nome da Empresa" id="nomea" name="nomea" />
<input type="submit" name="BTEnvia" value="Enviar" />
</form>
Either try putting a />
at the end:
<img src='http://fullpathofimagehere.jpg' />
or I think the //
inside the URL might be causing a problem but I'm not too sure about that.
EDIT:
How about trying to make a div and set the div's background url to whatever image you want? (you will have to do some inline styling inside the php)