|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
i'm playing a little bit with the mail function from PHP 5.2.4 and email headers. here is a snippet of my code: > $headers = 'From: '.$email."< ".$fromname." > >\r\n".'Reply-To:'.$email."\r\n".'X-Mailer: PHP/' . phpversion(); if (mail($to, $subject, $body,$headers)) { > .... > } > where: $fromname = $name.",".$firstname; when i run this code, and click on button "reply-to" it works well... i mean i reply to end user email address ($email). but i can see in my "FROM-TO" header space > From: correct_email_address [mailto:name@strange_email@including_partial_domain _name_of_mywebhosting] > > > "correct_email_address" is referencing to $email without problem. but the problem comes from "strange_email@including _partial_domain_name_of_mywebhosting". in fact, before @ i get a crazy value and why the rest (after @) i get my webhosting domain name ? can i turn this strange email address to the same as $email, in order to have "From : my_email_address@company.xxx [mailto: my_email_address@company.xxx]" ? thanks a lot, Alain ------------------------------------ Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Wed, Mar 12, 2008 at 10:28 AM, Alain Roger <raf.news@gmail.com> wrote:
> Hi, > > i'm playing a little bit with the mail function from PHP 5.2.4 and email > headers. > here is a snippet of my code: > > > $headers = 'From: '.$email."< ".$fromname." > > >\r\n".'Reply-To:'.$email."\r\n".'X-Mailer: PHP/' . phpversion(); You have the From: header parameters reversed. Try this: <? $headers = "From: ".$fromname." <".$email.">\r\n"; $headers .= "Reply-To: ".$email."\r\n"; $headers .= "X-Mailer: PHP/".phpversion()."\r\n"; /* .... */ ?> -- </Dan> Daniel P. Brown Senior Unix Geek <? while(1) { $me = $mind--; sleep(86400); } ?> |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
2008/3/12, Daniel Brown <parasane@gmail.com>:
> You have the From: header parameters reversed. Try this: > > <? > $headers = "From: ".$fromname." <".$email.">\r\n"; > $headers .= "Reply-To: ".$email."\r\n"; > $headers .= "X-Mailer: PHP/".phpversion()."\r\n"; > /* > .... > */ > ?> you can add these headers: $header = "From: $fromname<$email>\n"; $header .= "Reply-To: $email\n"; $header .= "Return-Path: <$email>\n"; $header .= "X-Mailer: PHP/" . phpversion() . "\n"; $header .= "MIME-Version: 1.0\n"; $header .= "Content-type: text/plain; charset=iso-8859-1\n"; $header .= "Content-Transfer-encoding: 7bit\n"; Try it. -- Scripts: http://www.spacemarc.it |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
ok i will try... what about UTF-8 to ensure unicode ?
my website and especially the form which will send this email, will be filled in by several nationalities... spanish, english, french, slovak, german,,... so isn't it easier to set up utf-8 ? A. On Wed, Mar 12, 2008 at 4:11 PM, spacemarc <spacemarc@gmail.com> wrote: > 2008/3/12, Daniel Brown <parasane@gmail.com>: > > You have the From: header parameters reversed. Try this: > > > > <? > > $headers = "From: ".$fromname." <".$email.">\r\n"; > > $headers .= "Reply-To: ".$email."\r\n"; > > $headers .= "X-Mailer: PHP/".phpversion()."\r\n"; > > /* > > .... > > */ > > ?> > > you can add these headers: > > $header = "From: $fromname<$email>\n"; > $header .= "Reply-To: $email\n"; > $header .= "Return-Path: <$email>\n"; > $header .= "X-Mailer: PHP/" . phpversion() . "\n"; > $header .= "MIME-Version: 1.0\n"; > $header .= "Content-type: text/plain; charset=iso-8859-1\n"; > $header .= "Content-Transfer-encoding: 7bit\n"; > > Try it. > > -- > Scripts: http://www.spacemarc.it > -- Alain ------------------------------------ Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
ok i will try... what about UTF-8 to ensure unicode ?
my website and especially the form which will send this email, will be filled in by several nationalities... spanish, english, french, slovak, german,,... so isn't it easier to set up utf-8 ? A. On Wed, Mar 12, 2008 at 4:11 PM, spacemarc <spacemarc@gmail.com> wrote: > 2008/3/12, Daniel Brown <parasane@gmail.com>: > > You have the From: header parameters reversed. Try this: > > > > <? > > $headers = "From: ".$fromname." <".$email.">\r\n"; > > $headers .= "Reply-To: ".$email."\r\n"; > > $headers .= "X-Mailer: PHP/".phpversion()."\r\n"; > > /* > > .... > > */ > > ?> > > you can add these headers: > > $header = "From: $fromname<$email>\n"; > $header .= "Reply-To: $email\n"; > $header .= "Return-Path: <$email>\n"; > $header .= "X-Mailer: PHP/" . phpversion() . "\n"; > $header .= "MIME-Version: 1.0\n"; > $header .= "Content-type: text/plain; charset=iso-8859-1\n"; > $header .= "Content-Transfer-encoding: 7bit\n"; > > Try it. > > -- > Scripts: http://www.spacemarc.it > -- Alain ------------------------------------ Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 -- Alain ------------------------------------ Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
ok, so this is what i got and it is still remaining... :-(
Received: from serdev ([127.0.0.1]) by home.com with MailEnable ESMTP; Wed, > 12 Mar 2008 16:40:18 +0100 > Date: Wed, 12 Mar 2008 16:40:18 +0100 > Subject: subject 3 > To: mymail@tek.com > From: raf, news <news.raf@gmail.com> > Reply-To: news.raf@gmail.com > Return-Path: <webmaster@localhost_home.com> > X-Mailer: PHP/5.2.4 > MIME-Version: 1.0 > Content-type: text/plain; charset=iso-8859-1 > Content-Transfer-encoding: 7bit > as you can see my Return-Path is still pointing on the wrong direction :-( any other idea ? A. On Wed, Mar 12, 2008 at 4:11 PM, spacemarc <spacemarc@gmail.com> wrote: > 2008/3/12, Daniel Brown <parasane@gmail.com>: > > You have the From: header parameters reversed. Try this: > > > > <? > > $headers = "From: ".$fromname." <".$email.">\r\n"; > > $headers .= "Reply-To: ".$email."\r\n"; > > $headers .= "X-Mailer: PHP/".phpversion()."\r\n"; > > /* > > .... > > */ > > ?> > > you can add these headers: > > $header = "From: $fromname<$email>\n"; > $header .= "Reply-To: $email\n"; > $header .= "Return-Path: <$email>\n"; > $header .= "X-Mailer: PHP/" . phpversion() . "\n"; > $header .= "MIME-Version: 1.0\n"; > $header .= "Content-type: text/plain; charset=iso-8859-1\n"; > $header .= "Content-Transfer-encoding: 7bit\n"; > > Try it. > > -- > Scripts: http://www.spacemarc.it > -- Alain ------------------------------------ Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
> as you can see my Return-Path is still pointing on the wrong direction :-( > any other idea ? return-path is set with the 5th mail() param: mail($to, $subject, $body, $headers, '-freturn_path_email@address.com'); -- Postgresql & php tutorials http://www.designmagick.com/ |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
Hi Chris,
interesting thing, but i get the following error message : *Warning*: mail() [function.mail<http://test4.rogtek.com/common/function.mail>]: SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE. in */test4/common/sendmail.php* on line *119* how can i solve this by only PHP ? i do not have access to web hosting server or php.ini. thx, Alain. On Thu, Mar 13, 2008 at 12:57 AM, Chris <dmagick@gmail.com> wrote: > > > as you can see my Return-Path is still pointing on the wrong direction > :-( > > any other idea ? > > return-path is set with the 5th mail() param: > > mail($to, $subject, $body, $headers, '-freturn_path_email@address.com'); > > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > -- Alain ------------------------------------ Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
Alain Roger wrote:
> Hi Chris, > > interesting thing, but i get the following error message : > *Warning*: mail() [function.mail > <http://test4.rogtek.com/common/function.mail>]: SAFE MODE Restriction > in effect. The fifth parameter is disabled in SAFE MODE. in > */test4/common/sendmail.php* on line *119* > > how can i solve this by only PHP ? i do not have access to web hosting > server or php.ini. 1 of 2 options. 1) Find another host with safe-mode disabled 2) Use something like phpmailer to send your emails through an smtp server -- Postgresql & php tutorials http://www.designmagick.com/ |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
hiChris,
i've read several forums where this mail() function from PHP initial package is not so great. Therefore a lot of people use PHPMailer which is more convenient for that purpose...especially more flexible. thanks a lot for your . Alain On Thu, Mar 13, 2008 at 8:35 AM, Chris <dmagick@gmail.com> wrote: > Alain Roger wrote: > > Hi Chris, > > > > interesting thing, but i get the following error message : > > *Warning*: mail() [function.mail > > <http://test4.rogtek.com/common/function.mail>]: SAFE MODE Restriction > > in effect. The fifth parameter is disabled in SAFE MODE. in > > */test4/common/sendmail.php* on line *119* > > > > how can i solve this by only PHP ? i do not have access to web hosting > > server or php.ini. > > 1 of 2 options. > > 1) Find another host with safe-mode disabled > 2) Use something like phpmailer to send your emails through an smtp server > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > -- Alain ------------------------------------ Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
Alain Roger wrote:
> hiChris, > > i've read several forums where this mail() function from PHP initial > package is not so great. mail() works fine. phpmailer (and zendmailer, swiftmailer and other such packages) you with things like: - sending through an smtp server - putting a multipart email together - adding attachments - embedding images in your email content and a whole bunch of other stuff so you don't have to write the code to do all of that. There's nothing fancy in any of them, and if you don't tell them to send through an smtp server, they use the normal mail() command (in most cases I think anyway). -- Postgresql & php tutorials http://www.designmagick.com/ |
|
![]() |
| Outils de la discussion | |
|
|