Parsing a variable with variables in it

the mail() function

Moderators: egami, macek, gesf

Post Reply
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Wed Feb 19, 2003 11:01 pm

mail with headers...


Code: Select all

$mymail="uadude@hotmail.com";
$subj="Hello, dude!";
$usermessage="Best regards. chao.";

$headers .= "MIME-Version: 1.0\r\n";
 $headers .= "Content-type: text/html; charset=windows-1251\r\n";
 $headers .= "From: Pejone <pejone@ukr.net>\r\n";
 $headers .= "X-Priority: 1\r\n";
 $headers .= "X-MSMail-Priority: High\r\n";
 $headers .= "X-Mailer: Pejone Feedback Form Mailer aka PFFM v1.0.2 special for alesh.ru\r\n";
 
mail($mymail, $subj, $usermessage, $headers);

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Thu Feb 20, 2003 6:23 am

Use fast tempelates for making $content =)

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Thu Feb 20, 2003 11:43 pm

I don like Fasttempelates, so i use functions

for exemple

Code: Select all

fucntion message_to_sent($Name, $Password, $email, $mymail)
{
$content="Hello $Name
Your login : $Name
Your pass: $Password

Bla-bla-bla...
Bye.
";

mail("$Name <$email>", "Subject", $content ,"From:  $mymail");
}

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Fri Feb 21, 2003 1:26 am

I've never looked at fast templates befor but here is what I would do.

Code: Select all

<?php
$content = "From: address@domain.com
Subject: Subject
Content: Hi [fname],
Your account is as follows:
Username: [username]
Password: [password]";

$content = str_replace('[fname]',$fname,$content);
$content = str_replace('[username]',$username,$content);
$content = str_replace('[password]',$password,$content);
?>





Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest