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

  • Home
  • SEARCH
  • 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 1001353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:39:29+00:00 2026-05-16T07:39:29+00:00

Made a small contact form on php, it gets $_POST variables and mails to

  • 0

Made a small contact form on php, it gets $_POST variables and mails to me.

<form action="/myscript.php" method="post">

Small piece of code:

$subject = trim($_POST['subject']);
$comment = trim($_POST['comment']);
mail($email, $subject, $comment, $headers);

$email is mine mail address, $headers are usual.

There is no filtration for subject and comment. Can it be a potential security hole to my site?

My mail is placed on gmail.com. Can unfiltered mail from my site hurt me, when I open gmail interface in browser?

How should I filter all the variables? Maybe I wish echo some of them on my site, after sending an email. (like ‘Thanks, %name% !’)

  • 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-16T07:39:30+00:00Added an answer on May 16, 2026 at 7:39 am

    No, it’s not that dangerous. Gmail doesn’t trust the e-mails you receive, otherwise every spammer would be able to compromise you.

    However, it’s a good practice to, at least, check if the variables exist and if their length doesn’t exceed the maximum.

    EDIT It’s possible that old versions of PHP were vulnerable to e-mail injection attacks, as described here. It would not compromise your site and your e-mail client should be able to handle malicious e-mails safely, but could potentially turn you into a spam relay.

    New versions do not exhibit this vulnerability, because all the control characters (those below 0x20) are sanitized. You can do the same sanitation like this:

    $subject = filter_input(INPUT_POST, "subject", FILTER_UNSAFE_RAW,
        FILTER_FLAG_STRIP_LOW);
    if ($subject === false) { /* subject not given/not scalar; handle it */ }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 488k
  • Answers 488k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer $('div.content:even').wrap('<div class="wrapper"></div>'); Note: I changed id to class since you… May 16, 2026 at 8:44 am
  • Editorial Team
    Editorial Team added an answer This is my workaround (Firefox works, IE 7/8 works): $(function()… May 16, 2026 at 8:44 am
  • Editorial Team
    Editorial Team added an answer Unfortunately, the styling of option elements is supported to different… May 16, 2026 at 8:44 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Post-release, I have made one small change to one form in our development site
I made small program to divide large pictures and take part of them. When
I use LINQ to SQL in a WPF project. I have made small changes
Ive made a small program in C#.net which doesnt really serve much of a
I made this small location class so that I can better handle address information
I made a small C# app to create an image in .jpg format. pictureBox.Image.Save(name,ImageFormat.Jpeg);
I made a small DLL in MSIL with two methods: float AddNumbers(int, int) int
I made a small program with Boost in Linux 2 yrs ago. Now I
I made a small page ( http://www.ovlu.li ) using CMS Made Simple ( http://www.cmsmadesimple.org/
I made a small change to an old java file in IntelliJ and when

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.