> -----Original Message-----
> From: Paul M Foster [mailto:pa...@quillandmouse.com] 
> Sent: Monday, January 11, 2010 8:51 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] corect way to use mail() function
> 
> On Mon, Jan 11, 2010 at 04:17:30PM -0600, LAMP wrote:
> 
> > Hi,
> > The company I work for, hosts online events registration 
> applications.
> > After a registered registered himself for an event he will get a
> > confirmation email saying he registered successfully.
> > Currently, in the header part of the mail(), in "From" it says e.g.
> > ord...@computility.com - because the email comes from us 
> not from our
> > client (e.g. ABC Assoc.). Reply-to goes to us too.
> >
> > Now one of our clients (e.g. ABC Assoc.) asks us to put in 
> the "from"
> > field their email, to looks like the email comes from them. 
> something
> > like: From: ABC Assoc. <eve...@abcaccos.org>;
> >
> > I refused to do that concerned we are going to be blacklisted for
> > sending "spam". Because header shows one place and From 
> field says other
> > email address - spam way of sending emails.
> >
> > Am I right or it really doesn't matter "who" sent the email?
> 
> Since the mail() function doesn't have a parameter for the 
> "From:", how
> do you force it to be a certain thing in the first place?
> 
> Paul

That's what the headers are for son! :)

        /**
         * This is the actual 'engine' that does the sending of an SMS or
Email.
         *
         * @access  static final
         * @return  void
         * @param       string $to the email address to send to
         * @param       string $subject the subject line of the message
         * @param       string $body the body of the message
         * @param       boolean $html use 'html' (true) or 'plain' (false)
         * @author  Daevid Vincent [daevid.vinc...@panasonic.aero]
         * @date        12/22/09
         * @see send_email()
         */
        static final function email($to, $subject, $body, $html=true)
        {
                $headers  = "MIME-Version: 1.0\r\n";
                $headers .= "Content-type: text/".( ($html) ? 'html' :
'plain')."; charset=iso-8859-1\r\n";
                $headers .= "From: ".COMPANY_FULL_NAME.' '.PRODUCT_NAME."
<".PRODUCT_SUPPORT_EMAIL.">\n";
                //$headers .= "Cc: Daevid Vincent
<daevid@".COMPANY_DOMAIN.">\r\n";
                //$headers .= "Bcc: presid...@example.com\r\n";
                //$headers .= "Reply-To: ".$myname."
<".$myreplyemail.">\r\n";
                $headers .= "X-Priority: 1\r\n";
                $headers .= "X-MSMail-Priority: High\r\n";
                $headers .= "X-Mailer: ".COMPANY_FULL_NAME." Linux Server";

                $body .= "<p>\n\n<i>This is an automated email from host
(".$_SERVER['SERVER_NAME'].") ".$_SERVER['SERVER_ADDR'].". Do not reply to
it.</i>";
                if (!$html) $body = strip_tags($body);

                mail($to, $subject, $body, $headers);
        }


        /**
         * Send this user an HTML email.
         *
         * @access      public
         * @return      boolean
         * @author      Daevid Vincent [daevid.vinc...@panasonic.aero]
         * @date        12/22/09
         * @see User::email()
         */
        public function send_email($subject, $body)
        {
                $to = $this->get_fullname().' <'.$this->email.'>';
                User::email($to, $subject, $body,
(strtolower($this->emailformat) == 'html') );
                add_user_log('Action', 'Email \''.$subject.'\' sent');
        }


ÐÆ5ÏÐ 
http://daevid.com

There are only 11 types of people in this world. Those that think binary
jokes are funny, those that don't, and those that don't know binary.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to