Using the mail() function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • techjohnny@gmail.com

    Using the mail() function

    I'd like to use the $headers field in the mail() function of PHP, but
    I'd like to be able to make these variable that somebody could change
    in a form.

    $headers .= 'To: $to' . "\r\n";


    Something like that above.

    Thanks,

    --TJ
  • Jerry Stuckle

    #2
    Re: Using the mail() function

    techjohnny@gmai l.com wrote:
    I'd like to use the $headers field in the mail() function of PHP, but
    I'd like to be able to make these variable that somebody could change
    in a form.
    >
    $headers .= 'To: $to' . "\r\n";
    >
    >
    Something like that above.
    >
    Thanks,
    >
    --TJ
    >
    Which will open your site as a spam relay, and quickly get your hosting
    account canceled.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • techjohnny@gmail.com

      #3
      Re: Using the mail() function

      On Feb 25, 3:51 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      techjoh...@gmai l.com wrote:
      I'd like to use the $headers field in the mail() function of PHP, but
      I'd like to be able to make these variable that somebody could change
      in a form.
      >
      $headers .= 'To: $to' . "\r\n";
      >
      Something like that above.
      >
      Thanks,
      >
      --TJ
      >
      Which will open your site as a spam relay, and quickly get your hosting
      account canceled.
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===
      Yeah, I realize that now. But, what about making one of the header
      fields a variable? I just don't understand the php syntax well enough
      to make this happen.

      --JP

      Comment

      • Jerry Stuckle

        #4
        Re: Using the mail() function

        techjohnny@gmai l.com wrote:
        On Feb 25, 3:51 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        >techjoh...@gma il.com wrote:
        >>I'd like to use the $headers field in the mail() function of PHP, but
        >>I'd like to be able to make these variable that somebody could change
        >>in a form.
        >>$headers .= 'To: $to' . "\r\n";
        >>Something like that above.
        >>Thanks,
        >>--TJ
        >Which will open your site as a spam relay, and quickly get your hosting
        >account canceled.
        >>
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstuck...@attg lobal.net
        >============== ====
        >
        Yeah, I realize that now. But, what about making one of the header
        fields a variable? I just don't understand the php syntax well enough
        to make this happen.
        >
        --JP
        >
        Read up on single and double quoting strings, for starters. You need
        either:

        $headers .= "To: $to\r\n";

        Or

        $headers .= 'To: ' . $to . "\r\n";

        Variables are not replaced when in single quotes.


        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Willem Bogaerts

          #5
          Re: Using the mail() function

          >>$headers .= 'To: $to' . "\r\n";
          >>Something like that above.
          >Which will open your site as a spam relay, and quickly get your hosting
          >account canceled.
          Yeah, I realize that now. But, what about making one of the header
          fields a variable? I just don't understand the php syntax well enough
          to make this happen.
          First thing to read about is mail injection. If you don't read up on
          that, your site will STILL be a spam relay.

          Good luck,
          --
          Willem Bogaerts

          Application smith
          Kratz B.V.

          Comment

          Working...