richard_PHP Posted March 4, 2008 Share Posted March 4, 2008 Hello all, Back with another problem.. Mail function. I have a feedback form for joining a band (join.htm), fill it out, send it and you get sent to a tank you page (mail.php). I get no errors on the mail.php page about the code and it all displays correctly. However, I have done this form four times now testing and I have no emails through. The account is on 110MB and I have purchased the upgrade to activate SendMail. Here's the code: <?php mail ('*email*', "Application", $_POST[name] . $_POST[email] . $_POST[queries]); ?> I really need help with this one! Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/94294-mail-function/ Share on other sites More sharing options...
craygo Posted March 4, 2008 Share Posted March 4, 2008 mail uses mail($to, $subject, $message, $headers); so you should do <?php $to = $_POST['email']; $subject = "Application"; $message = "hello and welcome blah blah blah"; // just some sample if using html $headers = "From: Myname <\myemail@mydomainl.com>\r\n"; //leave the next 2 lines alone $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; if(!mail($to, $subject, $message, $headers)){ echo "could not send e-mail; } else { echo "E-mail sent"; } ?> Ray Quote Link to comment https://forums.phpfreaks.com/topic/94294-mail-function/#findComment-482972 Share on other sites More sharing options...
richard_PHP Posted March 4, 2008 Author Share Posted March 4, 2008 <?php $to = "**email address**"; $subject = "Application"; $message = $_POST[name] . $_POST[email] . $_POST[queries]; //leave the next 2 lines alone $headers .= "MIME-Version: 1.0rn"; $headers .= "Content-Type: text/html; charset=ISO-8859-1rn"; if(!mail($to, $subject, $message, $headers)){ echo "Error! Could not send e-mail. Click <a href='join.htm'>here</a> to start again."; } else { echo "Thank you for your time. We will process your application shortly."; } ?> Works. BUT.. Is there any way that I can have the subject come through as a multiple line instead of one line which is extremely hard to read. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/94294-mail-function/#findComment-483015 Share on other sites More sharing options...
craygo Posted March 4, 2008 Share Posted March 4, 2008 \n will start a new line $subject = "application\n line2 \n line3"; Ray Quote Link to comment https://forums.phpfreaks.com/topic/94294-mail-function/#findComment-483019 Share on other sites More sharing options...
richard_PHP Posted March 4, 2008 Author Share Posted March 4, 2008 Sorry.. Not subject.. The message. Quote Link to comment https://forums.phpfreaks.com/topic/94294-mail-function/#findComment-483024 Share on other sites More sharing options...
craygo Posted March 4, 2008 Share Posted March 4, 2008 Well since this particular example is being sent using html, you can use <br> to go to another line $message = $_POST[name] ."<br>".$_POST[email]."<br>". $_POST[queries]; Quote Link to comment https://forums.phpfreaks.com/topic/94294-mail-function/#findComment-483067 Share on other sites More sharing options...
richard_PHP Posted March 4, 2008 Author Share Posted March 4, 2008 Problem solved! Thank you! ;D Quote Link to comment https://forums.phpfreaks.com/topic/94294-mail-function/#findComment-483114 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.