SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Sep 6, 2004, 20:39 #1
- Join Date
- Sep 2004
- Location
- el salvador
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
php variables in a MIME html mail
HI everyone. let me explain to you my problem.
I want to send and html mail with php. But i want this html mail to have some cuztomizable information.
i don't know how to do this, or if it is posible.
Let's asume that we have a form with 5 variables.(senderName, senderAdress,receiverName,receiverAdress,comment) wich ar send it via POST to a php file, who do the sending job.
this php file takes those variables and use them in the mail function, everything works, it sents the mail to the receiverAdress,
"To: $receiverName <$receiverAdress>\n"
from the receiver name:
"From: $senderName\n"
and send the html file.
but the problem is the i want to include some of those variables (receiverName,senderName,comment) into the html , but it ignore php code inside the html code.
Also i want to know if i can send a picture(how's stored in a database) inside that html code,
i don't know if i make myself clear.
please help me.
thanks for your time
-
Nov 23, 2004, 04:23 #2
- Join Date
- Nov 2004
- Location
- Mosjøen - Norway
- Posts
- 255
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi, I can't really help you...
Adding image attachement can be done using headers, not sure how to do it.
I to want to add variables in my $message ' ';
So I'm just gonna subscribe to this thread...
Sorry I couldn't help you in any way...
-
Nov 23, 2004, 05:49 #3
- Join Date
- Oct 2004
- Location
- UK
- Posts
- 2,676
- Mentioned
- 10 Post(s)
- Tagged
- 0 Thread(s)
How about:
PHP Code:$to = $_POST['receiverAddress'];
$subject = "Hello";
$from = "From: ".$_POST['senderAddress']."\n";
$body = "Hi, ".$_POST['receiverName'].".\n\n";
$body .= "Do you like my email?\n\n";
$body .= "To unsubscribe <a href = 'unsub.php?email=".$_POST['receiverAddress']."'>click here.</a>";
mail($to,$subject,$body,$from);
-
Nov 23, 2004, 06:02 #4
- Join Date
- Nov 2004
- Location
- Mosjøen - Norway
- Posts
- 255
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Actually I was working on this right now, and i found that using:
PHP Code:$message = "
<html>
<head>
<style type=\"text/css\">
.plain \{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
color:#666666;
}
</style>
</head>
<body>
<span class=\"plain\">Any html code u might need + $variables u might need...</span>
</body>
</html>
"
just enclose the html in " ", and escape all the " and the { in the html...
I guess any php functions u want done must be done 'before' u put the variables in the $message""...
I'm a neewbie so there might be an easier way to do this...
-
Nov 23, 2004, 06:17 #5
- Join Date
- Mar 2004
- Location
- West Midlands, United Kingdom
- Posts
- 2,631
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You can use heredoc syntax when you set the message variable.
Its explained here.
http://www.phpbuilder.com/manual/lan...syntax.heredoc
Bookmarks