Announcement

Collapse
No announcement yet.

Chaning the from: address when emailing users

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    I have now upgraded to v 2.3.0, how / where do I now change this new mail function? Can you tell me the exact line I need to replace?

    Many Thanks,
    Kerry

    Comment


    • #17
      I have found the code in the functions.php file, do I still need to use
      [email protected] for it to work, or what should I change in the code?

      // vBulletin wrapper for PHP's 'mail()' function
      function vbmail($toemail, $subject, $message, $from = '', $headers = '', $username = '') {
      global $bbtitle, $webmasteremail;

      $toemail = trim($toemail);
      $subject = trim($subject);
      $message = preg_replace("/(\r\n|\r|\n)/s", "\r\n", trim($message));
      $from = trim($from);
      $username = trim($username);

      // work out the 'From' header
      if ($from == '') {
      $headers = "From: \"$bbtitle Mailer\" <$webmasteremail>\r\n" . $headers;
      } else {
      $headers = 'From: "' . iif($username, "$username @ $bbtitle", $from) . "\" <$from>\r\n" . $headers;
      }

      // actually send the email message
      mail($toemail, $subject, $message, $headers);
      }

      Comment


      • #18
        All you need to do is take this code:
        PHP Code:
         // actually send the email message
        mail($toemail$subject$message$headers); 
        and replace it with this:
        PHP Code:
         // actually send the email message
        mail($toemail$subject$message$headers"-f$webmasteremail"); 

        Comment


        • #19
          Great, it seems to work! Kier you are a genius

          Comment


          • #20
            Glad to help

            Comment


            • #21
              okay so I would like it to do this:
              PHP Code:
               // work out the 'From' header
              if ($from == '') {
              $headers "From: \"$bbtitle Mailer\" <$webmasteremail>\r\n" $headers;
              } else {
              $headers 'From: "' iif($username"$username @ $bbtitle"$from) . "\" <$from>\r\n" $headers;

              obviously I can change the name for the regular emails from the forum itself by modifying this:
              PHP Code:
               $headers "From: \"$bbtitle Mailer\" <$webmasteremail>\r\n" 
              to
              PHP Code:
               $headers "From: \"NEW NAME HERE\" <$webmasteremail>\r\n" 
              now I use the email form for privacy for my members, instead of it showing the users email as the from, I would like to to show the bb username
              PHP Code:
               $headers 'From: "' iif($username"$username @ $bbtitle"$from) . "\" 
              so maybe?
              PHP Code:
              ?????????????? 
              this is where I am stuck

              edit: I would like the from user emails to read "$username - $hometitle" so when the email is received it says:

              Code:
              "$username - $hometitle" <[email protected]>
              it currently does this

              Last edited by SiXXGuNNZ; Sat 29 Mar '03, 1:23pm.

              Comment


              • #22
                yes I know this thread has already been helped, but do I really need to make a whole new thread?

                the main reason for changing this was, $bbtitle Mailer gets labeled as junk mail almost everywhere.

                and for changing the from on the email form, because it would look nicer to see who is sending the email with the forum name also included.

                Comment


                • #23
                  lol, point taken, or the ever ready this is hacking, ask at vb.org

                  thanks guys

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...
                  X