Jump to content
php.lv forumi

E-Mail nestrada


toms42

Recommended Posts

Vai kads nevarētu pateikt kāpēc šis skript nesuta man uz e-pastu vestuli?

 

contact.php

 

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>

<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>

 

 

send_contact.php

 

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>

<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>

 

P.S. Ja tas ko izsaka lietoju woano hostingu un gmail e-pastu

Link to comment
Share on other sites

Nepamani, ka tie divi ir vai nu vienādi,v ai arī ļoti līdzīgi?

Tās abas ir formas, bet nav paša koda kurš nosūtītu šos datus!

Ja nemaldos, sāc ar to ka tev vaig SMTP(maill servisu) un tad vēl klāt pašu sūtīšanas kodu!

Link to comment
Share on other sites

Kemito, kam tad vinjam SMTP ? vinam pietiks ar pliku mail(), vinam taksh nesutis 200 vestules diena ...

 

toms42

 

if(isset($_POST['submit'])) {
  // email parbaude
  if(preg_match("/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/", $_POST['email']) > 0) {
     // parbaudam izvilktos datus
     $subject = htmlspecialchars($_POST['subject']);
     $message = $_POST['detail'];
     $name    = htmlspecialchars($_POST['name']);
     $from    = htmlspecialchars($_POST['email']);
     // mail
     $email     = "tavs@epasts";
     $headers   = "From: " . $from . "\r\nReply-To: " . $from;
     $mail_sent = @mail( $email, $subject, $message, $headers );

     echo $mail_sent ? "OK" : "Error";
  } else {
     echo "Nepareizi uzradits emails";
  }
}

 

apmeram taa

Edited by 777
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...