470,849 Members | 1,196 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

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


//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' => 'g***@gcfi.org',
'Subject' => 'Test mime message'

$mime = new Mail_mime($crlf);


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

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

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


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. |
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Weston C | last post: by
1 post views Thread by praba kar | last post: by
6 posts views Thread by Vasileios Zografos | last post: by
1 post views Thread by George | last post: by
14 posts views Thread by chai | last post: by
9 posts views Thread by pbd22 | last post: by
2 posts views Thread by lawpoop | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.