|
#1
|
|||
|
|||
|
Shouldn't it be as simple as this to display the date in my email subject? When I run this it just display exactly what's written, ignores the code...
PHP Code:
|
|
#2
|
||||
|
||||
|
erm...
$subject = date(...); ?? As for the above, that's the body, not subject, and you're using the <<<...; method for setting a string, so it won't parse anything. There's limited parsing with the {$var} construct, but I think that's limited to variables. You could set $date = date(...); Then use {$date} in the <<<EOF thing, or you could just split the string and output (echo) date() directly, by itself, not as part of the EOF.
__________________
Daniel - <?php?> | <html>| Ich lerne Deutsch. | Studio l'italiano. | Estudiaba español. | Estudo português. | 日本語の勉強。| मैं हिन्दी सीखो | درس العربية |
|
#3
|
|||
|
|||
|
You need to fix your mail function... highlighted at red
Code:
mail($to, $subject, $message,header('From: '.$from));
__________________
This is a forum system not a PM system for questions. please treat it appropriately |
|
#4
|
||||
|
||||
|
Hmm... I don't think that's the original question.
And, The headers in the mail function aren't used with the header() function, I don't believe. header(), from how I have seen it used, outputs directly, before any html in the php script, to the browser, informing it as to the type of output (like html, or javascript, or jpeg). I might be wrong here, though, since I haven't gone too deep in the use of headers within the mail() function. I do know, though, that just a string with the right format will work for that.
__________________
Daniel - <?php?> | <html>| Ich lerne Deutsch. | Studio l'italiano. | Estudiaba español. | Estudo português. | 日本語の勉強。| मैं हिन्दी सीखो | درس العربية |
|
#5
|
||||
|
||||
|
It's a specific order of strings for the headers on the mail function, followed by \r\n after each one.
From php.net: Code:
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
|
|
#6
|
|||
|
|||
|
Use getdate() function to get the current date.
Code:
<?php
$message = “The following people are members as of echo date('d-m-Y');.
The login information is as follows:
-----------------------------------------“;
$subject = getdate();
$from = "Email <me@mydomain.com>";
mail($to, $subject, $message, 'From: '.$from);
}
?>
I think this answers your question. Last edited by tech_support; 04-16-2007 at 10:11 AM. Reason: Please wait until you have 5 posts before having a signature. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|