php-general Digest 10 Jan 2012 16:36:03 -0000 Issue 7643

Topics (messages 316238 through 316239):

Re: php sendmail_from
        316238 by: Duken Marga

Re: Variable Troubleshooting Code
        316239 by: Jim Lucas

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Actually, you can send an email from explicit email addres without
modifying htaccess or php ini.
In simple words, PHP uses MTA (like postfix or sendmail) to send email to
another email address. An email consist of header, body, and mime (for
example an attachment). Sender, receiver, Subject, and other parts of
message are laid in header. Body is used to store the message.

We can use PHP to write the header of message so we can change sender email
address. For example:

<?php
$to      = 'nob...@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmas...@example.com' . "\r\n" .
    'Reply-To: webmas...@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

You can see the example above from PHP manual.

On Tue, Jan 10, 2012 at 1:53 AM, alexus <ale...@gmail.com> wrote:

> I need to change sendmail from field, I added following to my .htaccess:
>
> php_value sendmail_from 'x...@xxx.xxx'
>
> and tried to send out an email, but it still comes from apache@FQDN
>
> through phpinfo(); I see as local value my email address x...@xxx.xxx
>
> --
> http://alexus.org/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Duken Marga
http://duken.info

--- End Message ---
--- Begin Message ---
On 01/09/2012 07:16 PM, Donovan Brooke wrote:
Just to share, a Mr. Harkness forwarded me a consolidated version of my
code.. basically substituting the innards for:


if (!isset($pmatch) || substr($key,0,strlen($pmatch)) == $pmatch) {
print "$key = $value<br />";
}


Cheers,
Donovan




I would change the above the the following:

if ( empty($pmatch) || ( strpos($key, $pmatch) === 0 ) ) {
  print "$key = $value<br />";
}

it would be slightly faster

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

--- End Message ---

Reply via email to