Page 1 of 1

HTML Email

Posted: 23 Mar 2014, 00:15
by AnonimUser
Salut,

Ma ajutati si pe mine va rog frumos ? As dorii sa fac asa:

Code: Select all

Name*:
Email-ul tau*:
Mesaj*:

[b]TRIMITE[/b]
Cand apasa trimite, cum pot sa fac sa trimita pe un email anume ce a scris. Adica, sa setez sa trimita pe email-ul "[email protected]"

Multumesc frumos.

Re: HTML Email

Posted: 23 Mar 2014, 00:49
by The Kalu
Nu este testat,l-am facut in 5 minute.Design iti faci tu.

Code: Select all

<?php

define('DESTINATAR', 'SUPPORTSITE <[email protected]>'); //Doar un exemplu
define('SUBIECT', 'Un titlu anume,SUPPORT CEVA');

     /*
     Trimite e-mail
     */
     if(isset($_POST['submit'])){
      
      $mail = array();
       foreach($_POST as $keyData => $data_post){
          $mail[] = $data_post;
       }
       
        $nume  = filter_input(INPUT_POST, $mail[0], FILTER_SANITIZE_SPECIAL_CHARS);
        $mail  = filter_input(INPUT_POST, $mail[1], FILTER_SANITIZE_EMAIL);
        $mesaj = filter_input(INPUT_POST, $mail[2], FILTER_SANITIZE_SPECIAL_CHARS);
        
               $full_message = '
               '.$nume.'('.$mail.') ti-a trimis urmatorul mesaj:
                  </br >
                  '.$mesaj.'
               ';

         $headers  = 'MIME-Version: 1.0' . "\r\n";
         $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
         $headers .= 'To: '.DESTINATAR.'' . "\r\n";

         mail(DESTINATAR, SUBIECT, $full_message, $headers);
     }
?>


  <form action="" method="post">
  
        Nume: <input type="text" size="18" name="nume" />
        E-mail: <input type="text" size="18" name="email" />
        Mesaj: <input type="text" size="18" name="mesaj" />
        
        <input type="submit" name="submit" value="Trimite mail" />
        
  </form>

Re: HTML Email

Posted: 23 Mar 2014, 10:32
by Genky
terra , nu este bun !

Re: HTML Email

Posted: 23 Mar 2014, 12:33
by Only-Games
Am gasit un PHP Mailer, sper sa te ajute. Link download ai aici.

Re: HTML Email

Posted: 23 Mar 2014, 15:49
by Awakening

Code: Select all

<?php
define("UNDE_AJUNGE_EMAILUL_TRIMIS","[email protected]");
error_reporting(0);
?>
<!DOCTYPE HTML>
<html>
<head>
   <title>SendMail</title>
   <style>
   body{background-color:#c1c1c1;font-size:17px;font-family:tahoma;margin:0px;color:#1c1c1c;}
   h2{margin-top:-1px;}
   h4{margin-top:0px;}
   #_sendform{background-color:#efefef;color:#c1c1c1;width:450px;margin-top:150px;padding:11px;border-top-left-radius:10px;border-top-right-radius:10px;text-align:left;}
   #_sendform:hover{opacity:0.7;filter:alpha(opacity=70);}
   #_sendtitle{color:#c1c1c1;margin-top:-20px;}
   #_sendheader{background-color:#fff;color:#c1c1c1;width:450px;padding:11px;text-align:left;}
   #_inputform{padding:7px;width:230px;}
   #_txtarea{padding:7px;width:230px;height:120px;}
   hr{background-color:#efefef;border:0px;height:1px;margin-top:-10px;}
   #_sendbutton{padding:7px;color:#FFF;font-weight:bold;border:0px;border-radius:7px;text-align:center;width:120px;cursor:pointer;background-image: -webkit-linear-gradient(top,#0066CC,#000000);background-image: -moz-linear-gradient(top,#0066CC,#000000);background-image: -o-linear-gradient(top,#0066CC,#000000);}
   #_errorbox{background-image:-webkit-linear-gradient(top,#FF0000,#1c1c1c);background-image:-moz--linear-gradient(top,#FF0000,#1c1c1c);background-image:-o-linear-gradient(top,#FF0000,#1c1c1c);font-size:15px;color:#FFF;font-weight:bold;padding:11px;border-radius:7px;}
   </style>
</head>
<body>
   
<center>
<form method="post" action=?action=send />
<div id="_sendform">
<h2>SendMail</h2>
<p id="_sendtitle">Trimite mesajul tau</p>
</div>
<div id="_sendheader">
<?php
$action=$_GET["action"];

if($action=="send")
{
   $mail=$_POST["mail"];
   $subiect=$_POST["subiect"];
   $continut=$_POST["continut"];
   
   $Cmail=strip_tags($mail);
   $Csubiect=strip_tags($subiect);
   $Ccontinut=strip_tags($continut);
   
   if(strlen($Cmail) < 10 )
   {
      echo "<div id=\"_errorbox\">Adresa de email nu este valida.</div><br />";
   }
   else if(strlen($Csubiect) < 10 )
   {
      echo "<div id=\"_errorbox\">Subiectul trebuie sa contina minim 10 caractere.</div><br />";
   }
   else if(strlen($Ccontinut) < 50 )
   {
      echo "<div id=\"_errorbox\">Mesajul trimis trebuie sa fie mai lung de 50 de caractere.</div><br />";
   }
   else
   {
        $to = "".UNDE_AJUNGE_EMAILUL_TRIMIS."";

        $subject = "$Csubiect";

        $headers = "From: [email protected]\r\n";
        $headers .= "CC: [email protected]\r\n";
        $headers .= "MIME-Version: 1.0\r\n";

        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";


        $message = '<html><body>';
        $message .= "$Ccontinut";
        $message .= "<br /><br />Adresa email a celui care a trimis acest mesaj: $Cmail";
        $message .= '</body></html>';


        mail($to, $subject, $message, $headers);
        echo "<div id=\"_errorbox\">Mesajul a fost trimis cu succes.</div><br />";
   }
}

?>

Email:<br />
<input type="text" value="<?php echo $Cmail; ?>" size="" maxlength="40" id="_inputform" name="mail" placeholder="[email protected]">
<br /><br />
Subiectul mesajului:<br />
<input type="text" value="<?php echo $Csubiect; ?>" size="" maxlength="30" id="_inputform" name="subiect" placeholder="Subiect">
<br /><br />
Continut mesaj:<br />
<textarea id="_txtarea" name="continut" placeholder="Mesajul tau..." maxlength="900"><?php echo $Ccontinut; ?></textarea>
<br /><br />
<hr>
<input type="submit" value="Trimite" id="_sendbutton">
</form>
</div>
</center>

</body>
</html>
Probat, functional.

Modifici de la linia 2:

Code: Select all

define("UNDE_AJUNGE_EMAILUL_TRIMIS","[email protected]");
Cu adresa de email pe care vrei sa primesti mail-urile trimise

PS: Iti recomand sa introduci si in el si un captcha, poate chiar recaptcha de la google ca este usor de instalat, altfel poate primesti spam de mail-uri.

Re: HTML Email

Posted: 23 Mar 2014, 16:43
by AnonimUser
Multumesc la toti!
Sunteti bestiali.