开发者

php mail() wont send email

开发者 https://www.devze.com 2023-02-16 21:50 出处:网络
I\'m a beginning php coder (really beginner) and I need to make a postcard-sending script but it wont send my emails.

I'm a beginning php coder (really beginner) and I need to make a postcard-sending script but it wont send my emails.

<?php
$to_name = $_REQUEST['to_name'];
$to_email = $_REQUEST['to_email'];
$subject = 'teszt';

$msg = 'proba';

mail($to_mail, $subject, $msg, 'From:' . 'teszt@valami.hu');
?>  

<label for='to_name''>Címzett neve:</label>
<input type='text' name='to_name' id='to_name' class='gbi' size='30'>
<label for='to_email''>Címzett email cime:</label>
<input type='text' name='to_email' id='to_email' class='gbi' size='30'>

<label for='name''>Az ön neve:</label>
<input type='text' name='name' id='name' class='gbi' size='30'>

<label for='email''>Az ön email cime:</label>
<input type='text' name='email' id='email' class='gbi' size='30'>

<label for='text''>Üzenet:</label>
<textarea name='text' id='text' class='pct' ></textarea>
<br开发者_如何学运维>
<input type='submit' >

Yes it is it a form :)

So the point is I made 4 images, every for images have a different submit button, so when they click on it a for pops up for the image.

I tried everything to send out the mails and no luck.

Any advice?


Please submit all of your code including <form..> tag.

Also can you replace your php code to this and try again:

<?php 
   if (!empty($_REQUEST['to_email'])) {
      $to_name = $_REQUEST['to_name'];
      $to_email = $_REQUEST['to_email'];
      $subject = 'teszt';
      $msg = 'proba';

      mail($to_mail, $subject, $msg );
   }
?>


I would suggest forgoing mail() all together, and using swiftmailer. It's not hard to setup, even for someone just starting.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号