subkiller Posted February 18, 2009 at 10:47 AM Report Share #245300 Posted February 18, 2009 at 10:47 AM 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 More sharing options...
psiico Posted February 18, 2009 at 11:53 AM Report Share #245302 Posted February 18, 2009 at 11:53 AM tenta pesquisar pela class PHPMail ou PHPmailer. Psiico // Portfolio Link to comment Share on other sites More sharing options...
infopc Posted February 18, 2009 at 11:32 PM Report Share #245464 Posted February 18, 2009 at 11:32 PM subkiller, será porque estás a utilizar o WAMP numa maquina Windows e não tens servidor de smtp configurado nela? ? não sei mas acho que sim. phpMailer óptima solução mas continua a precisar de um servidor de SMTP (gmail por exemplo) O que não tem solução, solucionado esta... Link to comment Share on other sites More sharing options...
subkiller Posted February 19, 2009 at 10:21 AM Author Report Share #245503 Posted February 19, 2009 at 10:21 AM tb acho que é isso... mas o codigo que eu tenho é o suficiente para eu enviar um email, nao é? e como funciona o phpmailer? desde ja obrigado pela ajuda.... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now