Jump to content

Recommended Posts

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.  ;D

Link to comment
https://forums.phpfreaks.com/topic/94294-mail-function/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/94294-mail-function/#findComment-482972
Share on other sites

        <?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. ;D

Link to comment
https://forums.phpfreaks.com/topic/94294-mail-function/#findComment-483015
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.