Enviando Email em localhost
04/02/2016
0
Olá fórum, não estou conseguindo enviar uma pagina de formulário do meu site para o meu e-mail.Sou iniciante nesse assunto, gostaria de saber se tenho que baixar algum programa para fazer isso ou é tudo através de comandos. Por favor me ajudem, eu tenho um pc ubuntu e o site é no localhost.
desde já agradeço
marcelo
desde já agradeço
marcelo
Marcelo Hohn
Curtir tópico
+ 0
Responder
Posts
04/02/2016
William
Marcelo poste seu script para análise dos colegas, fica difícil entender seu problema sem ver o que está sendo executado!
Responder
05/02/2016
Marcelo Hohn
Olá o meu código do formulário segue abaixo
<style>
{}
span{
font-size:9pt;
color:red;
}
</style>
<script>
function mascara(o,f){
v_obj=o
v_fun=f
setTimeout("execmascara()",1)
}
function execmascara(){
v_obj.value=v_fun(v_obj.value)
}
function leech(v){
v=v.replace(/o/gi,"0")
v=v.replace(/i/gi,"1")
v=v.replace(/z/gi,"2")
v=v.replace(/e/gi,"3")
v=v.replace(/a/gi,"4")
v=v.replace(/s/gi,"5")
v=v.replace(/t/gi,"7")
return v
}
function soNumeros(v){
return v.replace(/\D/g,"")
}
function telefone(v){
v=v.replace(/\D/g,"")
v=v.replace(/^(\d\d)(\d)/g,"($1) $2")
v=v.replace(/(\d)(\d)/,"$1-$2")
return v
}
function cf(v){
v=v.replace(/\D/g,"")
v=v.replace(/(\d)(\d)/,"$1.$2")
v=v.replace(/(\d)(\d)/,"$1.$2")
v=v.replace(/(\d)(\d{1,2})$/,"$1-$2")
return v
}
function cp(v){
v=v.replace(/D/g,"")
v=v.replace(/^(\d)(\d)/,"$1-$2")
return v
}
</script>
<script language="javascript">
/*----------------------------------------------------------------------------
Formatação para qualquer mascara
-----------------------------------------------------------------------------*/
function formatar(src, mask){
var i = src.value.length;
var saida = mask.substring(0,1);
var texto = mask.substring(i)
if (texto.substring(0,1) != saida)
{
src.value += texto.substring(0,1);
}
}
</script>
<body onload="document.all.nome.focus();">
<div id="col3">
<h4>Contato</h4>
<form action="enviar.php" method="POST">
<input type="hidden">
<center>
<table border="0" align="left" cellspacing="0" cellpadding="0" class=fundo width=565px>
<tr>
<td><p class=titulo><small>Nome: </small><br><input type="text" size="30" name=nome value=""></p></td>
</tr>
<tr>
<td><p class=titulo><small>E-mail:</small><br> <input type="text" size="30" name="email" value=""></p></td>
</tr>
<tr>
<td><p class=titulo><small>Telefone:</small><br> <input
type=text name=fone onkeypress="mascara(this,telefone)" maxlength="14" size=15><span>(##) ####-####</span></p></td>
</tr>
<tr>
<td><p class=titulo><small>Assunto:</small><br> <input type="text" size="30" name="assunto" value=""></p></td>
</tr>
<tr>
<td><p class=titulo><small>Mensagem:</small><br>
<textarea cols="40" rows="10" name="mensagem"></textarea> </p>
</td>
</tr>
<tr>
<td style="padding-bottom:10px;padding-left:5px;"><input name="submit" type="submit" value="Enviar" id=enviar>
<input name="reset" type="reset" value="Limpar" id=limpar></td>
</tr>
</table>
</center>
</form>
</div>
</body>
</html>
porém não consigo enviar isso para o meu email.
que no enviar.php está o seguinte código
<?
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From: email@gmail.com\r\n";
fulano2@gmail.com
$destinatario = "email2@hotmail.com";
$assunto = "Teste da Função mail()";
$mensagem = "
<html>
<head>
<title>Teste de Envio</title>
</head>
<body>
<font face=\"Arial\" size=\"2\" color=\"#333333\">
<br />
Nome: <b>Roberto Carlos</b><br />
E-mail: <b>roberto.carlos@gmail.com</b>
</font>
</body>
";
mail($destinatario, $assunto, $mensagem, $headers);
?>
se possivel conseguirem me auxiliar
<style>
{}
span{
font-size:9pt;
color:red;
}
</style>
<script>
function mascara(o,f){
v_obj=o
v_fun=f
setTimeout("execmascara()",1)
}
function execmascara(){
v_obj.value=v_fun(v_obj.value)
}
function leech(v){
v=v.replace(/o/gi,"0")
v=v.replace(/i/gi,"1")
v=v.replace(/z/gi,"2")
v=v.replace(/e/gi,"3")
v=v.replace(/a/gi,"4")
v=v.replace(/s/gi,"5")
v=v.replace(/t/gi,"7")
return v
}
function soNumeros(v){
return v.replace(/\D/g,"")
}
function telefone(v){
v=v.replace(/\D/g,"")
v=v.replace(/^(\d\d)(\d)/g,"($1) $2")
v=v.replace(/(\d)(\d)/,"$1-$2")
return v
}
function cf(v){
v=v.replace(/\D/g,"")
v=v.replace(/(\d)(\d)/,"$1.$2")
v=v.replace(/(\d)(\d)/,"$1.$2")
v=v.replace(/(\d)(\d{1,2})$/,"$1-$2")
return v
}
function cp(v){
v=v.replace(/D/g,"")
v=v.replace(/^(\d)(\d)/,"$1-$2")
return v
}
</script>
<script language="javascript">
/*----------------------------------------------------------------------------
Formatação para qualquer mascara
-----------------------------------------------------------------------------*/
function formatar(src, mask){
var i = src.value.length;
var saida = mask.substring(0,1);
var texto = mask.substring(i)
if (texto.substring(0,1) != saida)
{
src.value += texto.substring(0,1);
}
}
</script>
<body onload="document.all.nome.focus();">
<div id="col3">
<h4>Contato</h4>
<form action="enviar.php" method="POST">
<input type="hidden">
<center>
<table border="0" align="left" cellspacing="0" cellpadding="0" class=fundo width=565px>
<tr>
<td><p class=titulo><small>Nome: </small><br><input type="text" size="30" name=nome value=""></p></td>
</tr>
<tr>
<td><p class=titulo><small>E-mail:</small><br> <input type="text" size="30" name="email" value=""></p></td>
</tr>
<tr>
<td><p class=titulo><small>Telefone:</small><br> <input
type=text name=fone onkeypress="mascara(this,telefone)" maxlength="14" size=15><span>(##) ####-####</span></p></td>
</tr>
<tr>
<td><p class=titulo><small>Assunto:</small><br> <input type="text" size="30" name="assunto" value=""></p></td>
</tr>
<tr>
<td><p class=titulo><small>Mensagem:</small><br>
<textarea cols="40" rows="10" name="mensagem"></textarea> </p>
</td>
</tr>
<tr>
<td style="padding-bottom:10px;padding-left:5px;"><input name="submit" type="submit" value="Enviar" id=enviar>
<input name="reset" type="reset" value="Limpar" id=limpar></td>
</tr>
</table>
</center>
</form>
</div>
</body>
</html>
porém não consigo enviar isso para o meu email.
que no enviar.php está o seguinte código
<?
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From: email@gmail.com\r\n";
fulano2@gmail.com
$destinatario = "email2@hotmail.com";
$assunto = "Teste da Função mail()";
$mensagem = "
<html>
<head>
<title>Teste de Envio</title>
</head>
<body>
<font face=\"Arial\" size=\"2\" color=\"#333333\">
<br />
Nome: <b>Roberto Carlos</b><br />
E-mail: <b>roberto.carlos@gmail.com</b>
</font>
</body>
";
mail($destinatario, $assunto, $mensagem, $headers);
?>
se possivel conseguirem me auxiliar
Responder
Clique aqui para fazer login e interagir na Comunidade :)