Jump to content

erro ao enviar email


subkiller
 Share

Recommended Posts

boas

criei um sistema de neviar email simples para o meu site...

<?php

@session_start();
include "protection.php";

if(isset($_POST["enviar"]))
{
$email_destino=$_POST["email_destino"];
$email_from=$_POST["email_from"];
$assunto=$_POST["assunto"];
$mensagem=$_POST["mensagem"];

if($email_destino<>"" && $email_from<>"" && $assunto<>"" && $mensagem<>"")
{
	if(mail($email_destino, $assunto, $mensagem,"FROM: ".$email_from))
	{
		$estado="<p><font color='green'>Email enviado com sucesso</font></p>";
	}
	else
	{
		$estado="<p><font color='red'>Erro ao enviar email</font></p>";
	}
}
else
{
	$estado="<p><font color='red'>Preencher todos os campos</font></p>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Termofilm, Máquinas alimentares</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<link rel="shortcut icon" href="favicon.ico" />
</head>
<body>

<div id="top">
<img src="img/logo.png" alt="logo" />
</div>

<div id="menu">
</div>

<div id="efeito">
</div>

<div id="content" class="clearfix">
<h1>Area de Administração</h1>
<h1>Enviar e-mails</h1>
</div>

<div id="conteudo2" class="clearfix">

<img class= "1" src="img/embalagem.jpg" alt="logo"/>
<img class= "1" src="img/maquina.jpg" alt="logo" />

<h6><li><a href="home.php">Home</a></li></h6>

<h6>Enviar e-mails</h6>

<?php
    if(isset($estado))
{
	echo $estado;
}
?>

<center>
    <form action="admin_send_mail.php" method="POST">
<h6>Destinatario:</h6><input type="text" name="email_destino"> <br>
<h6>De:</h6><input type="text" name="email_from"> <br>
<h6>Assunto:</h6><input type="text" name="assunto"> <br>
<h6>Mensagem:</h6><textarea rows="13" cols="50" name="mensagem"></textarea><br><br>
<input type="submit" name="enviar" value="Enviar">
</form>
</center>

<div id="bot" class="clearfix">
</div>

<div id="footer" class="clearfix">
<h6>©Termofilm, LDA</h6>
</div>

</body>
</html>

mas da-me um erro quando carrego no enviar:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\site termofilm\admin\admin_send_mail.php on line 15

ja estive a procura na net e pelo que percebi tenho de alterar a porta do localhost mas nao sei como isso se faz....

alguem me pode ajudar?

cumps.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.