Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6794661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:14:56+00:00 2026-05-26T18:14:56+00:00

I am having the hardest time to get a simple sendmail.php to work. My

  • 0

I am having the hardest time to get a simple sendmail.php to work.
My form html is

<form action=sendmail.php id=contact-form method=post>
    <p>
        <label for=cf_name>Name *</label>
        <input id=cf_name name=cf_name placeholder='Enter your name...' required=required title=Name type=text />
    </p>
    <p>
        <label for=cf_email>Email *</label>
        <input id=cf_email name=cf_email placeholder='Email address...' required=required     title='Email address' type=email />
    </p>
    <p>
        <label for=cf_subject>Subject *</label>
        <input id=cf_subject name=cf_subject placeholder='Specify subject...' required=required title=Subject type=text />
    </p>
    <p>
        <label for=cf_message>Message *</label>
        <textarea id=cf_message name=cf_message placeholder='Message text...' required=required rows=10 title='Message text'></textarea>
    </p>
    <p>
        <input type=submit value='Send message'/>
    </p>
</form>

And my mailer script is:

<?
    $cf_email = $_POST['cf_email'] ;
    $cf_message = $_POST['cf_message'] ;
    $cf_subject = $_POST['cf_subject'] ;
    $cf_name = $_POST['cf_name'] ;

    mail( "[email removed]", $cf_subject, $cf_message, $cf_name, $cf_email );
    print "Congratulations your email has been sent";
?>

Just want an email to to go to my email. When it appears in the inbox, the subject they typed is the one that I will see as the subject in my inbox. The from will be their name. The email it came from will be their email And the message inside will be the message they wrote in the form.
Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:14:57+00:00Added an answer on May 26, 2026 at 6:14 pm

    You might want to look at the example in the PHP documentation.

    Basically it looks like you aren’t passing the arguments to mail() correctly.

    From http://php.net/manual/en/function.mail.php it should be:

    mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
    

    Using example #4 as a reference from the PHP documentation you should be able to do this:

    $cf_email = $_POST['cf_email'] ;
    $cf_message = $_POST['cf_message'] ;
    $cf_subject = $_POST['cf_subject'] ;
    $cf_name = $_POST['cf_name'] ;
    
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: ' . $cf_name . ' <' . $cf_email . '>' . "\r\n";
    
    mail('chriscct7@gmail.com', $cf_subject, $cf_message, $headers);
    

    But as Homer6 has said, I’d recommend using something like swiftmailer if you can.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having the hardest time trying to get my class to work properly. It's
I am having the hardest time trying to figure out this (should be) simple
I am having the hardest time trying to get the current time in EDT
I'm having the hardest time with what should be super simple. I can't grab
I'm having the hardest time understanding how min-height is supposed to work. I figured
I'm having the hardest time getting this to work. I'm trying to copy a
Check this link! I am having the hardest time trying to figure out why
I'm having the hardest time getting Eclipse to connect and reverse engineer from a
I am having the hardest time finding urls to use in Scala Designer 5
I'm having the hardest time with this. I don't even understand the error messages

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.