dynamic elements in mail_mime

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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


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

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

$crlf = "\n";
$hdrs = array(
              'From'    => 'gcfi@gcfi.org',
              'Subject' => 'Test mime message'

$mime = new Mail_mime($crlf);


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

$mail =& Mail::factory('mail');
$mail->send('test@mydomain.org', $hdrs, $body);

Re: dynamic elements in mail_mime

Sophisticado wrote:
Quoted text here. Click to load it

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.

$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");


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.  |

Site Timeline