Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End creating a email sender for web page using php

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #169843
    Moorthi
    Participant

    i create a form for web paging and working the validation. but can’t sending the mail

    #169896
    shaneisme
    Participant
    #169920
    __
    Participant

    but can’t sending the mail

    Any time you want to ask for help, make sure you:

    • describe your problem, in specific terms.
    • what did you try to do, and what did you expect to happen?
    • what actually happened?
    • share your code, specifically, the part where the problem is.

    Telling us “it doesn’t work,” or similarly vague complaints, is completely useless. First, it’s obvious: if your code were working, you wouldn’t be asking for help, right? Be descriptive, be specific, give examples.

    #169968
    Moorthi
    Participant

    i ll try this mail function..but not sending via local host

    #169972
    __
    Participant

    i ll try this mail function..but not sending via local host

    Do you have a mail server running on your local machine?

    mail simply submits an email to a mail server —it isn’t a mail server itself. If you don’t have a mail server, it cannot work.

    #170004
    Moorthi
    Participant

    traq.,
    how to get the mail server for windows xp.

    #170005
    Moorthi
    Participant

    when i submit the form to display for php code in a web page.does not accessing the code.

    #170019
    Taufik Nurrohman
    Participant

    Just make sure you create a proper email header:

    $header  = "From: " . $_POST['email'] . " \r\n";
    $header .= "Reply-To: " . $_POST['email'] . " \r\n";
    $header .= "Return-Path: " . $_POST['email'] . " \r\n";
    $header .= "X-Mailer: PHP \r\n";
    
    mail('[email protected]', 'Inbox!', 'Test message.', $header);
    

    Guide and reasons: http://www.html-form-guide.com/email-form/php-script-not-sending-email.html

    #170037
    __
    Participant

    how to get the mail server for windows xp.

    there are many options.
    Honestly, setting up an email server is beyond the scope of a forum discussion.

    You can either spend a few days/weeks studying and then try it yourself (this is the stage where, if/when you have specific problems, it would be appropriate to ask on a discussion board), or —if it is important/ time-sensitive— you could hire someone who already knows how to do it.

    when i submit the form to display for php code in a web page.does not accessing the code.

    I do not understand what you mean by this. What do you want to display? what “code” do you want to access? what are you doing to try to achieve this? what is actually happening when you try?

    Please be specific, and describe each item clearly, individually, in its own sentence.

    Just make sure you create a proper email header […]
    http://www.html-form-guide.com/email-form/php-script-not-sending-email.html

    That article does a pretty good job of describing how to troubleshoot emails, and of how various headers should be configured.

    However, it (and your example code) introduces header injection vulnerabilities, which could turn your website into a spam server.

    For example:

    $header .= "Reply-To: " . $_POST['email'] . " \r\n";
    

    Never Trust User Input. $_POST['email'] is supposed to be a single email address, but it could be anything. What if it is a list of hundreds of email addresses? or what if it contains an \r\n, followed by more headers, which you never intended to add? what if it contains an email attachment? a virus?

    If that happens, then this approach will simply allow it to happen. You can get your email server blacklisted. You can lose your webhost account. It’s very hard (i.e., usually impossible) to prove who actually does things like this, but make no mistake, you will be the one who has to deal with the consequences. You might even be held responsible by your web host.

    Always Validate and Sanitize User Input. In this case, $_POST['email'] is supposed to be a single email address, so make sure it is a single email address:

    $userEmail = filter_var( $_POST['email'],FILTER_VALIDATE_EMAIL );
    if( ! $userEmail ){
        /*  $_POST['email'] was not a valid email.  stop!  */
    }
    
    #170120
    Moorthi
    Participant

    Name:
    Your Email Address:

    Message:

           submit
    

    i need code for mail function

    #170136
    __
    Participant

    i need code for mail function

    You have two options:

    • try, and then ask questions when you need help with a specific problem. I (and likely others as well) will be happy to help.
    • hire someone to do it for you.
Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Back End’ is closed to new topics and replies.