0

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:' . '[email protected]');
?>  

<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?

9
  • sorry not postcars postcard :) Commented Mar 16, 2011 at 3:05
  • and really sorry about my typeing, its almost sunrise and i ahvent slept a bit Commented Mar 16, 2011 at 3:08
  • Are you using POST to submit the form data? Commented Mar 16, 2011 at 3:08
  • 1
    Does your mail() command return true or false? You should check return values, they can be useful. Check your server's mail logs (mailq may do the job), was an email accepted for delivery? Was the delivery attempted? Did delivery fail for any good reasons? Commented Mar 16, 2011 at 3:16
  • Most importantly: do you have a mail server? Commented Mar 16, 2011 at 3:17

2 Answers 2

1

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 );
   }
?>
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.