Reply to Re: mail function

Your name:

Reply:


Posted by maya on 06/11/06 16:11

Bent Stigsen wrote:
> maya wrote:
>
>
>>I'm learning how to send mail with php...
>>
>>only thing that mystifies me a bit is I can't get NAME of sender to
>>appear in e-mail INBOX under "from"... I only see e-mail address.. I'm
>>coming from Java, with Java you can set it up so whatever user puts
>>under "name" in the form you can grab and in e-mail INBOX under "from"
>>you see sender's name, not e-mail address.. I would like to be able to
>>do this with php.. I've looked at various tutorials, and so far can't
>>see how you can do this.. thank you..
>
>
> If you use the mail-function, then there is an example of this in the
> manual.
> http://dk2.php.net/manual/en/function.mail.php
>
> From "Example 4.":
> $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
>
>
> /Bent

thank you very much Bent...

I have:

$sendername = $_GET['name'];
$email = $_GET['email'];
$headers = 'From: $sendername <$email>' . "\r\n";

in email INBOX it says from $sendername (literally, does not print name...)

if I do

$headers .= 'From: $sendername <$email>' . "\r\n";

(add the '.' right before '=' like in example you cited..)
I get an error (undefined var in line where $header var is declared..)

I'm new to php.. and I would like to know, please, why is there a '.'
sometimes before '='.. what is this for.. (it's not working for me right
now, though..)

one thing that I find weird about php is how you can print vars inside
or outside quotes... i.e., if I want to print a variable with some html
I have to include in quotes not only the html (which makes sense), but
also the variable, for example:

echo $x; // if I want to add some html here I have to do

echo "$x<br>"; // I think this is very weird..

I'm used to Java, in which you would do:

out.print(varName + "<br>"); // :)

thank you very much....

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация