RE: [PHP] variables in e-mail 2nd

2003-10-17 Thread Daevid Vincent
Oh, one more thing that's worthy of note. This method "renders" a page so
you don't have to worry about htaccess protected content and authentication.

What do I mean by that? Well, for example, my CRiMson project uses
mod_auth_mysql to validate a user and let them in. It protects the entire
/crimson/ tree at the apache level. Using the method below, I can use
graphics, includes, .css, .js, etc all found in that dir tree in my template
email. Then when I send it, the user does NOT have to authenticate/login
just to read the email :-)

Daevid Vincent
http://daevid.com
  

> -Original Message-
> From: Daevid Vincent [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 17, 2003 10:55 AM
> To: 'christian tischler'; [EMAIL PROTECTED]
> Subject: RE: [PHP] variables in e-mail 2nd
> 
> What I do is make a PHP page/template with php variables in place.
> 
> Then do something like this...
> 
>   $report = "path/to/mytemp.php";
> 
>   $today = date();
> 
>   ob_start();
>   include($report);
>   $message = ob_get_contents();
>   ob_end_clean();
>   //echo $message;
> 
>   $to = "Daevid Vincent <[EMAIL PROTECTED]>";
>   //$to .= ", "."Daevid Vincent <[EMAIL PROTECTED]>"; // note the
> comma
> 
>   $headers  = "MIME-Version: 1.0\r\n";
>   //$headers .= "Content-type: text/plain; 
> charset=iso-8859-1\r\n";
>   $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
>   $headers .= "From: CRiMson <".WEBMASTER.">\r\n";
>   //$headers .= "Cc: [EMAIL PROTECTED]";
>   //$headers .= "Bcc: [EMAIL PROTECTED]";
>   //$headers .= "Reply-To: ".$myname." <".$myreplyemail.">\r\n";
>   //$headers .= "X-Priority: 1\r\n";
>   //$headers .= "X-MSMail-Priority: High\r\n";
>   $headers .= "X-Mailer: CRiMson Server";
>   
>   $subject = "my report";
> 
> //echo $message;
>   
> mail($to, $subject, $message, $headers);
> 
> That's the slick as shit solution. Then PHP will pull in your 
> 'template'
> page and any variables or whatever are executed in the 
> template $report,
> plus any that you have in your program (such as $today) are 
> passed in to
> $message as well...
> 
> Daevid Vincent
> http://daevid.com
>   
> 
> > -Original Message-
> > From: christian tischler [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, October 17, 2003 7:10 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] variables in e-mail 2nd
> > 
> > I would like to use a form in a html page to pass the 
> > variables to a php
> > page, which sends an mail including these variables.
> > 
> > All I get in the mail though is a 1 rather than the string 
> > that I put into
> > the form???
> > 
> > Can anyone help please!
> > 
> > Some code I use
> > .
> > .
> > .
> > $messagepart1 = '
> >   Free Subscription  
> > Somebody would like to have a free subscription!!! ';
> >   $messagepart2 = (echo $salutation);
> >   $messagepart3 = '   ';
> > $message = $messagepart1.$messagepart2.$messagepart3;
> > .
> > .
> > .
> > mail([EMAIL PROTECTED], "Free Subscription Application", $message, 
> $headers);
> > .
> > .
> > .
> > 
> > The $salutation comes from the form and is handed over 
> > correctly, but the
> > syntax for to display the value of the variable in the html 
> > e-mail seems to
> > be the problem...
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



RE: [PHP] variables in e-mail 2nd

2003-10-17 Thread Daevid Vincent
What I do is make a PHP page/template with php variables in place.

Then do something like this...

$report = "path/to/mytemp.php";

$today = date();

ob_start();
include($report);
$message = ob_get_contents();
ob_end_clean();
//echo $message;

$to = "Daevid Vincent <[EMAIL PROTECTED]>";
//$to .= ", "."Daevid Vincent <[EMAIL PROTECTED]>"; // note the
comma

$headers  = "MIME-Version: 1.0\r\n";
//$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: CRiMson <".WEBMASTER.">\r\n";
//$headers .= "Cc: [EMAIL PROTECTED]";
//$headers .= "Bcc: [EMAIL PROTECTED]";
//$headers .= "Reply-To: ".$myname." <".$myreplyemail.">\r\n";
//$headers .= "X-Priority: 1\r\n";
//$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: CRiMson Server";

$subject = "my report";

//  echo $message;

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

That's the slick as shit solution. Then PHP will pull in your 'template'
page and any variables or whatever are executed in the template $report,
plus any that you have in your program (such as $today) are passed in to
$message as well...

Daevid Vincent
http://daevid.com
  

> -Original Message-
> From: christian tischler [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 17, 2003 7:10 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] variables in e-mail 2nd
> 
> I would like to use a form in a html page to pass the 
> variables to a php
> page, which sends an mail including these variables.
> 
> All I get in the mail though is a 1 rather than the string 
> that I put into
> the form???
> 
> Can anyone help please!
> 
> Some code I use
> .
> .
> .
> $messagepart1 = '
>   Free Subscription  
> Somebody would like to have a free subscription!!! ';
>   $messagepart2 = (echo $salutation);
>   $messagepart3 = '   ';
> $message = $messagepart1.$messagepart2.$messagepart3;
> .
> .
> .
> mail([EMAIL PROTECTED], "Free Subscription Application", $message, $headers);
> .
> .
> .
> 
> The $salutation comes from the form and is handed over 
> correctly, but the
> syntax for to display the value of the variable in the html 
> e-mail seems to
> be the problem...
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



Re: [PHP] variables in e-mail 2nd

2003-10-17 Thread Marek Kilimajer
christian tischler wrote:
  $messagepart2 = (echo $salutation);
 $messagepart2 = $salutation;

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


Re: [PHP] variables in e-mail 2nd

2003-10-17 Thread David Otton
On Fri, 17 Oct 2003 15:09:48 +0100, you wrote:

>I would like to use a form in a html page to pass the variables to a php
>page, which sends an mail including these variables.
>
>All I get in the mail though is a 1 rather than the string that I put into
>the form???
>
>Can anyone help please!
>
>Some code I use
>.
>.
>.
>$messagepart1 = '
>  Free Subscription  
>Somebody would like to have a free subscription!!! ';
>  $messagepart2 = (echo $salutation);
>  $messagepart3 = '   ';
>$message = $messagepart1.$messagepart2.$messagepart3;
>.
>.
>.
>mail([EMAIL PROTECTED], "Free Subscription Application", $message, $headers);

Missing quotes around the email address.

Echo the $message string as you send it, to make sure it contains what you
think it contains.

$messagepart2 = (echo $salutation);

is probably not what you meant. Try

$messagepart2 = $salutation;

instead.

What additional headers are you sending?

BTW, if the email address is coming from the outside world (your text
implies that), then your form can be used as part of a DoS attack.

>The $salutation comes from the form and is handed over correctly, but the
>syntax for to display the value of the variable in the html e-mail seems to
>be the problem...

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