Illasera Posted December 26, 2010 Share Posted December 26, 2010 Hey all, I am sending mail via ZendMail, And i wish to know how to list of products in the mail body,Consider the following example, I have an array of string written in php, And i wish to display them in my mail body,How do i achieve that? I can`t call php functions/operators within the mail, What do i need to do, Here is an example : // Mail php array.<?php$mail_Products = array("Apple", "Bigger apples", "How do you like them apples");?><!-- Mail body --><html><!-- rquired Start & end tags -->$mail_Products = Will display "Array"</html> foreach/list = I can`t call since i can`t parse php operator within html.print_r = I can`t call since i cant parse php functions within html.I can`t use <php /> tags as well, since i cant parse server data within mail unless its pre-processed.Any ideas? Link to comment Share on other sites More sharing options...
Synook Posted December 26, 2010 Share Posted December 26, 2010 Why don't you just create a string that represents the array? $mail_products = array("Apple", "Bigger apples", "How do you like them apples");$products_str = "";foreach ($mail_products as $p) { $products_str .= "$p<br>";} $mail_products = array("Apple", "Bigger apples", "How do you like them apples");$products_str = print_r($mail_products, true); Then just put $products_str into the mail body.P.S. there is no such thing as the <php> element. Link to comment Share on other sites More sharing options...
Illasera Posted December 26, 2010 Author Share Posted December 26, 2010 Why don't you just create a string that represents the array?$mail_products = array("Apple", "Bigger apples", "How do you like them apples");$products_str = "";foreach ($mail_products as $p) { $products_str .= "$p<br>";} $mail_products = array("Apple", "Bigger apples", "How do you like them apples");$products_str = print_r($mail_products, true); Then just put $products_str into the mail body.P.S. there is no such thing as the <php> element. Why don't you just create a string that represents the array?I don`t understand, The reason i am using an array, Is because i need to query a list of products from each user and send it via mail.Unless there is some sort of mathod to undo the array combination and just resolve it into a simple string?like so : $Test = array("help", "me");$Test_String = Some sort of function to convert the array into 1 long simple string...?P.S. there is no such thing as the <php> element.I believe that once you save your file as a .php, Your file is actually getting parsed by a php parser, and once it reaches a php tag,It start parsing the syntax in its own special way. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.