473,320 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

dynamic elements in mail_mime

Apologies for x-posting.

I am trying to embed dynamic elements collected from a form in a mime
mail. The form sends elements to other pages, a database, and a text
mail() message; but, I am unable to send it to a mime e-mail message. I
am guessing the problem is in the definition of the dynamic element in
the $html section. A test email snippet follows. For the purposes of
the test, I set it up to receive the definition of an element [regdate]
that is defined within this file - not an external form so I can get the
php and html syntax correct.) The mime mail e-mails correctly but does
not include the data from the defined element - the output is simply:
"$regdate; HTML version of email".
I've tried numerous interations including adding the php definition <?
php print "regdate"; ?> in the $html section of the message. Any help is
appreciated!

<?php
include('Mail.php');
include('Mail/mime.php');
?>

<?php
//set regdate
$regdate = date("Y-m-d");?>

<?php
$text = 'Text version of email';
$html = '<html><body>
$regdate;
HTML version of email</body></html>';
$crlf = "\n";
$hdrs = array(
'From' => 'g***@gcfi.org',
'Subject' => 'Test mime message'
);

$mime = new Mail_mime($crlf);

$mime->setTXTBody($text);
$mime->setHTMLBody($html);

$body = $mime->get();
$hdrs = $mime->headers($hdrs);

$mail =& Mail::factory('mail');
$mail->send('t***@mydomain.org', $hdrs, $body);
?>
Jul 17 '05 #1
1 1967
Sophisticado wrote:
....
<?php
//set regdate
$regdate = date("Y-m-d");?>

<?php
$text = 'Text version of email';
$html = '<html><body>
$regdate;
HTML version of email</body></html>';

(snip)

single quotes do not interpolate, ie, they do not expand $variables
specified inside them. For that you need double quotes; or you could
concatenate the string with the dot operator.

<?php
$regdate = '2004-07-21';

$html1 = 'date: $regdate'; /* does not do what you expect */
$html2 = "date: $regdate"; /* OK */
$html3 = 'date: ' . $regdate; /* OK */

echo nl2br("1: $html1\n\n2: $html2\n\n3: $html3");
?>
HTH

--
USENET would be a better place if everybody read: | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html | header, textonly |
http://www.expita.com/nomime.html | no attachments. |
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Weston C | last post by:
I'm having some trouble with Mail_Mime... it looks as if it isn't handling the creation of headers transparently. Here's what I'm essentially doing: $MimeMesg = new Mail_mime();...
1
by: praba kar | last post by:
Dear All, email.Message module base we can build message for mailing services which is like php Mail_mime module. In php Mail_mime module willautomatically build all the header fields like...
6
by: Vasileios Zografos | last post by:
Hello, I have a function that generates some values (e.g. vertices in 2d space) the number of which I dont know. So, it could generate 20 vertices, 100 vertices, or even 1 vertex. void...
1
by: George | last post by:
I've got an interesting problem that I just have not been able to figure out. I'm trying to use Mail_Mime to send multi-part/mixed emails from a Linux server and I am having trouble getting...
14
by: chai | last post by:
Can anyone help me in finding elements stored in a dynamic array in.
7
by: Venus | last post by:
Hello, I am trying to generate a dynamic form at runtime and would like to do it using "<asp: ..." form elements as follows Build up the string that is placed somewhere in the HTML code the...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
2
by: lawpoop | last post by:
Hello all -- I'm having a problem getting images to appear in the body of an HTML email using PEAR's mail_mime class. Here's my code, what am I doing wrong? include("Mail.php");...
1
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.