zoobie
asked on
Passing variables into mailer
Hello -
This will be an easy 250 points for someone familiar with passing variables. I'm using PHP version 4.0.6. and I almost had it but grew tired of trial and error. You could probably get it on close to the first try. The author's gone AWOL.
I need to have 2 selected variables (gifs) and comments from myform.php page passed into the example.html page which is then sent via the mailer.
Like I said, this will probably be easy. I have changed the files into text files for easy viewing and they are complete with comments. The html file example.html is just a regular page and can be viewed in the files listed below. The mailer just opens files, embeds them, and sends whatever's in the example.html. I have commented out some un-needed coding in the send.php but feel free to reinclude it if needed.
The files you will need to view are:
http://geocities.com/zoobie007/mimemailer/send.txt (myform.php's action=send.php)
http://geocities.com/zoobie007/mimemailer/class.html.mime.mail.txt
Other files you probably won't need to view:
http://geocities.com/zoobie007/mimemailer/class.smtp.txt
http://geocities.com/zoobie007/mimemailer/mimePart.txt
http://geocities.com/zoobie007/mimemailer/example.html
One last thing...The debugging should be turned off. When I comment it out, it throws an error.
Enjoy!
Sincerely,
Z
Here is:
myform.php
<html><head></head><body>
<form name=myform method=post action=send.php
<input type="text" name="receiver" size="20">
<select name="pic">
<option>Pictures</option>
<option value="alfred">Alfred</opt ion>
<option value="smiley">Smiley</opt ion>
</select>
<select name="pic2">
<option>Pictures</option>
<option value="goofy">Goofy</optio n>
<option value="chips">Chips</optio n>
</select>
<textarea name="comments" cols="44" rows="11" wrap="VIRTUAL"></textarea>
<input type="submit" name="Submit" value="Send">
<input type="reset" name="Clear" Value="Clear">
</form></body></html>
This will be an easy 250 points for someone familiar with passing variables. I'm using PHP version 4.0.6. and I almost had it but grew tired of trial and error. You could probably get it on close to the first try. The author's gone AWOL.
I need to have 2 selected variables (gifs) and comments from myform.php page passed into the example.html page which is then sent via the mailer.
Like I said, this will probably be easy. I have changed the files into text files for easy viewing and they are complete with comments. The html file example.html is just a regular page and can be viewed in the files listed below. The mailer just opens files, embeds them, and sends whatever's in the example.html. I have commented out some un-needed coding in the send.php but feel free to reinclude it if needed.
The files you will need to view are:
http://geocities.com/zoobie007/mimemailer/send.txt (myform.php's action=send.php)
http://geocities.com/zoobie007/mimemailer/class.html.mime.mail.txt
Other files you probably won't need to view:
http://geocities.com/zoobie007/mimemailer/class.smtp.txt
http://geocities.com/zoobie007/mimemailer/mimePart.txt
http://geocities.com/zoobie007/mimemailer/example.html
One last thing...The debugging should be turned off. When I comment it out, it throws an error.
Enjoy!
Sincerely,
Z
Here is:
myform.php
<html><head></head><body>
<form name=myform method=post action=send.php
<input type="text" name="receiver" size="20">
<select name="pic">
<option>Pictures</option>
<option value="alfred">Alfred</opt
<option value="smiley">Smiley</opt
</select>
<select name="pic2">
<option>Pictures</option>
<option value="goofy">Goofy</optio
<option value="chips">Chips</optio
</select>
<textarea name="comments" cols="44" rows="11" wrap="VIRTUAL"></textarea>
<input type="submit" name="Submit" value="Send">
<input type="reset" name="Clear" Value="Clear">
</form></body></html>
Can you say what is NOT working?
Or do you want to know how to access HTML form variables in PHP?
In older versions of PHP, you would use ...
$HTTP_method_VARS["variabl e_name"]
where method can be ...
POST, GET, COOKIES, SERVER
So,
to access the variable "receiver" which has been POSTed, in older PHP's, you would use
$HTTP_POST_VARS["receiver" ]
In newer PHPs you would use
$_method["variable"]
e.g.
$_POST["receiver"]
You can then treat these as your PHP variables, or, if you want, move them to local storage.
Richard.
In older versions of PHP, you would use ...
$HTTP_method_VARS["variabl
where method can be ...
POST, GET, COOKIES, SERVER
So,
to access the variable "receiver" which has been POSTed, in older PHP's, you would use
$HTTP_POST_VARS["receiver"
In newer PHPs you would use
$_method["variable"]
e.g.
$_POST["receiver"]
You can then treat these as your PHP variables, or, if you want, move them to local storage.
Richard.
ASKER
Quote: "I need to have 2 selected variables (gifs) and comments from myform.php page passed into the example.html page which is then sent via the mailer."
This is on a virtual host, btw.
I'm finished doing trial and error. I will just keep posting 'till someone cashes in...I have all year.
Both the send.php and the example.php needs fixing so the above can be accomplished.
This is on a virtual host, btw.
I'm finished doing trial and error. I will just keep posting 'till someone cashes in...I have all year.
Both the send.php and the example.php needs fixing so the above can be accomplished.
Just to be sure ...
You want to upload 2 GIF images to the server and then have then emailed or simple names of 2 GIF images?
If they are names, where are they coming from?
Or have you hard-coded them?
Or you want to select 2 images you already have on the server and have them emailed?
Or are you just emailing the names?
But, I think I sort of understand what you want.
In your send.php you have 2 lines ...
$text = $mail->get_file('example.t xt');
$html = $mail->get_file('example.h tml');
These relate to the files stored locally.
Try this ...
<?php
/************************* ********** ****
** Filename.......: example.1.php
** Project........: HTML Mime Mail class
** Last Modified..: 01 October 2001
************************** ********** ***/
/*
Having trouble? Read this article on HTML email: http://www.arsdigita.com/asj/mime/
*/#
error_reporting(E_ALL);
include('class.html.mime.m ail.inc');
/************************* ********** ****
** Example of usage. This example shows
** how to use the class with html,
** embedded images, and an attachment,
** using the usual methods.
************************** ********** ***/
/************************* ********** ****
** This is optional, it will default to \n
** If you're having problems, try changing
** this to either \n (unix) or \r (Mac)
************************** ********** ***/
define('CRLF', "\r\n", TRUE);
/************************* ********** ****
** Create the mail object. Optional headers
** argument. Do not put From: here, this
** will be added when $mail->send
** Does not have to have trailing \r\n
** but if adding multiple headers, must
** be seperated by whatever you're using
** as line ending (usually either \r\n or \n)
************************** ********** ***/
$mail = new html_mime_mail(array('X-Ma iler: Html Mime Mail Class'));
/************************* ********** ****
** Read the image background.gif into
** $background
************************** ********** ***/
$background = $mail->get_file('backgroun d.gif');
/************************* ********** ****
** Read the file test.zip into $attachment.
************************** ********** ***/
//$attachment = $mail->get_file('example.z ip');
/************************* ********** ****
** If sending an html email, then these
** two variables specify the text and
** html versions of the mail. Don't
** have to be named as these are. Just
** make sure the names tie in to the
** $mail->add_html() call further down.
************************** ********** ***/
/* _RAQ_ Create the text and HTML messages. */
$sText = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$_POST["receiver"]}.
The pictures you want are {$_POST["pic"]} and {$_POST["pic2"]}.
Your comments are :
{$_POST["comments"]}
Thank you.
<<<END_TEXT;
$sHtml = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$_POST["receiver"]}</b >.</div>
<div>The pictures you want are <b>{$_POST["pic"]}</b> and <b>{$_POST["pic2"]}</b>.</ div>
<div>Your comments are :<br><br><b>{$_POST["comme nts"]}</b> </div>
<div>Thank you.</div>
<<<END_TEXT;
/* _RAQ_ Save the text and HTML messages into temporary files.
NOTE : You will need to check your servers tmp location or have adequate permissions to write to your own directory!!!
*/
$tmpText = tempnam ("/tmp", "_mail_text_");
$tmpHtml = tempnam ("/tmp", "_mail_html_");
$fp = fopen($tmpText, "w");
fwrite($fp, $sText);
fclose($fp);
$fp = fopen($tmpHtml, "w");
fwrite($fp, $sHtml);
fclose($fp);
/* Use the temporary filenames. */
$text = $mail->get_file($tmpText);
$html = $mail->get_file($tmpHtml);
/************************* ********** ****
** Add the text, html and embedded images.
** The name of the image should match exactly
** (case-sensitive) to the name in the html.
************************** ********** ***/
$mail->add_html($html, $text);
$mail->add_html_image($bac kground, 'background.gif', 'image/gif');
/************************* ********** ****
** This is used to add an attachment to
** the email.
************************** ********** ***/
//$mail->add_attachment($a ttachment, 'example.zip', 'application/zip');
/************************* ********** ****
** Builds the message.
************************** ********** ***/
if(!$mail->build_message() )
die('Failed to build email');
/************************* ********** ****
** Send the email using smtp method.
** This is the preferred method of sending.
************************** ********** ***/
include('class.smtp.inc');
$params = array(
'host' => '10.1.1.2', // Mail server address
'port' => 25, // Mail server port
'helo' => 'example.com', // Use your domain here.
'auth' => FALSE, // Whether to use authentication or not.
'user' => '', // Authentication username
'pass' => '' // Authentication password
);
$smtp =& smtp::connect($params);
$send_params = array(
'from' => 'joe@example.com', // The return path
'recipients' => 'richard@[10.1.1.2]', // Can be more than one address in this array.
'headers' => array(
'From: "Joe" <joe@example.com>',
'To: "Richard Heyes" <richard@[10.1.1.2]>', // A To: header is necessary, but does
'Subject: Test email' // not have to match the recipients list.
)
);
$mail->smtp_send($smtp, $send_params);
/* _RAQ_ Delete the temporary files. */
unlink($tmpText);
unlink($tmpHtml);
/************************* ********** ****
** Debug stuff. Entirely unnecessary.
************************** ********** ***/
echo '<PRE>'.htmlentities($mail ->get_rfc8 22('Richar d', 'richard@[10.1.1.2]', 'Joe', 'joe@example.com', 'Example email using HTML Mime Mail class')).'</PRE>';
?>
Note. The code I've added has _RAQ_ in the comments to help you find the changes.
Is this the sort of thing you are wanting?
Regards,
Richard Quadling.
You want to upload 2 GIF images to the server and then have then emailed or simple names of 2 GIF images?
If they are names, where are they coming from?
Or have you hard-coded them?
Or you want to select 2 images you already have on the server and have them emailed?
Or are you just emailing the names?
But, I think I sort of understand what you want.
In your send.php you have 2 lines ...
$text = $mail->get_file('example.t
$html = $mail->get_file('example.h
These relate to the files stored locally.
Try this ...
<?php
/*************************
** Filename.......: example.1.php
** Project........: HTML Mime Mail class
** Last Modified..: 01 October 2001
**************************
/*
Having trouble? Read this article on HTML email: http://www.arsdigita.com/asj/mime/
*/#
error_reporting(E_ALL);
include('class.html.mime.m
/*************************
** Example of usage. This example shows
** how to use the class with html,
** embedded images, and an attachment,
** using the usual methods.
**************************
/*************************
** This is optional, it will default to \n
** If you're having problems, try changing
** this to either \n (unix) or \r (Mac)
**************************
define('CRLF', "\r\n", TRUE);
/*************************
** Create the mail object. Optional headers
** argument. Do not put From: here, this
** will be added when $mail->send
** Does not have to have trailing \r\n
** but if adding multiple headers, must
** be seperated by whatever you're using
** as line ending (usually either \r\n or \n)
**************************
$mail = new html_mime_mail(array('X-Ma
/*************************
** Read the image background.gif into
** $background
**************************
$background = $mail->get_file('backgroun
/*************************
** Read the file test.zip into $attachment.
**************************
//$attachment = $mail->get_file('example.z
/*************************
** If sending an html email, then these
** two variables specify the text and
** html versions of the mail. Don't
** have to be named as these are. Just
** make sure the names tie in to the
** $mail->add_html() call further down.
**************************
/* _RAQ_ Create the text and HTML messages. */
$sText = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$_POST["receiver"]}.
The pictures you want are {$_POST["pic"]} and {$_POST["pic2"]}.
Your comments are :
{$_POST["comments"]}
Thank you.
<<<END_TEXT;
$sHtml = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$_POST["receiver"]}</b
<div>The pictures you want are <b>{$_POST["pic"]}</b> and <b>{$_POST["pic2"]}</b>.</
<div>Your comments are :<br><br><b>{$_POST["comme
<div>Thank you.</div>
<<<END_TEXT;
/* _RAQ_ Save the text and HTML messages into temporary files.
NOTE : You will need to check your servers tmp location or have adequate permissions to write to your own directory!!!
*/
$tmpText = tempnam ("/tmp", "_mail_text_");
$tmpHtml = tempnam ("/tmp", "_mail_html_");
$fp = fopen($tmpText, "w");
fwrite($fp, $sText);
fclose($fp);
$fp = fopen($tmpHtml, "w");
fwrite($fp, $sHtml);
fclose($fp);
/* Use the temporary filenames. */
$text = $mail->get_file($tmpText);
$html = $mail->get_file($tmpHtml);
/*************************
** Add the text, html and embedded images.
** The name of the image should match exactly
** (case-sensitive) to the name in the html.
**************************
$mail->add_html($html, $text);
$mail->add_html_image($bac
/*************************
** This is used to add an attachment to
** the email.
**************************
//$mail->add_attachment($a
/*************************
** Builds the message.
**************************
if(!$mail->build_message()
die('Failed to build email');
/*************************
** Send the email using smtp method.
** This is the preferred method of sending.
**************************
include('class.smtp.inc');
$params = array(
'host' => '10.1.1.2', // Mail server address
'port' => 25, // Mail server port
'helo' => 'example.com', // Use your domain here.
'auth' => FALSE, // Whether to use authentication or not.
'user' => '', // Authentication username
'pass' => '' // Authentication password
);
$smtp =& smtp::connect($params);
$send_params = array(
'from' => 'joe@example.com', // The return path
'recipients' => 'richard@[10.1.1.2]', // Can be more than one address in this array.
'headers' => array(
'From: "Joe" <joe@example.com>',
'To: "Richard Heyes" <richard@[10.1.1.2]>', // A To: header is necessary, but does
'Subject: Test email' // not have to match the recipients list.
)
);
$mail->smtp_send($smtp, $send_params);
/* _RAQ_ Delete the temporary files. */
unlink($tmpText);
unlink($tmpHtml);
/*************************
** Debug stuff. Entirely unnecessary.
**************************
echo '<PRE>'.htmlentities($mail
?>
Note. The code I've added has _RAQ_ in the comments to help you find the changes.
Is this the sort of thing you are wanting?
Regards,
Richard Quadling.
Oops.
On the lines that START with <<<
Remove the <<<
Should be ...
$sText = <<<END_TEXT
...
END_TEXT;
NOT
<<<END_TEXT;
The same for the END_HTML too.
Sorry.
Richard.
On the lines that START with <<<
Remove the <<<
Should be ...
$sText = <<<END_TEXT
...
END_TEXT;
NOT
<<<END_TEXT;
The same for the END_HTML too.
Sorry.
Richard.
ASKER
Ok Richard...This is a completely different way than my last attempt...
Anyway, it's giving me:
Parse error: parse error in /www/php50.com/html/zoobie /send.php on line 172
As far as I know, there IS no domain "html" or line 172 for that matter.
The mailer grabs a file...in this case, gifs, and embeds it into the email. This is why I'm thinking the example.html should be modified to accept the variables.
Something like:
example.html
<html><head></head><body>
<img src="$pic.gif"></img>
<img src="$pic2.gif"></img>
$comments
</body></html>
like the directions say to do...except they say to use the actual file name e.g. <img src="smiley.gif"> which of course, I can't do because it's a variable from myform.php page containing several choices.
I'm also using $HTTP_POST_VARS["pic"] as it's version 4.0.6
Anyway, it's giving me:
Parse error: parse error in /www/php50.com/html/zoobie
As far as I know, there IS no domain "html" or line 172 for that matter.
The mailer grabs a file...in this case, gifs, and embeds it into the email. This is why I'm thinking the example.html should be modified to accept the variables.
Something like:
example.html
<html><head></head><body>
<img src="$pic.gif"></img>
<img src="$pic2.gif"></img>
$comments
</body></html>
like the directions say to do...except they say to use the actual file name e.g. <img src="smiley.gif"> which of course, I can't do because it's a variable from myform.php page containing several choices.
I'm also using $HTTP_POST_VARS["pic"] as it's version 4.0.6
Did you remove the extra <<<'s?
Can you also change the extension on the HTML file as all I get is a "Well done you sent it" message.
ASKER
And something like perhaps:
$pic = $mail->get_file('$HTTP_POS T_VARS["pi c"]');
$pic2 = $mail->get_file('$HTTP_POS T_VARS["pi c2"]');
$mail->add_html_image($pic , '$pic.gif', 'image/gif');
$mail->add_html_image($pic 2, '$pic2.gif', 'image/gif');
I have no idea...obviously.
Thanks
$pic = $mail->get_file('$HTTP_POS
$pic2 = $mail->get_file('$HTTP_POS
$mail->add_html_image($pic
$mail->add_html_image($pic
I have no idea...obviously.
Thanks
ASKER
Yes...I removed the extra <<<'s
This is what I have so far. I've commented some things out for testing. Maybe it's that permissions you mentioned...:
<?php
/************************* ********** ****
** Filename.......: example.1.php
** Project........: HTML Mime Mail class
** Last Modified..: 01 October 2001
************************** ********** ***/
/*
Having trouble? Read this article on HTML email: http://www.arsdigita.com/asj/mime/
*/#
error_reporting(E_ALL);
include('xxx.php');
/************************* ********** ****
** Example of usage. This example shows
** how to use the class with html,
** embedded images, and an attachment,
** using the usual methods.
************************** ********** ***/
/************************* ********** ****
** This is optional, it will default to \n
** If you're having problems, try changing
** this to either \n (unix) or \r (Mac)
************************** ********** ***/
define('CRLF', "\r\n", TRUE);
/************************* ********** ****
** Create the mail object. Optional headers
** argument. Do not put From: here, this
** will be added when $mail->send
** Does not have to have trailing \r\n
** but if adding multiple headers, must
** be seperated by whatever you're using
** as line ending (usually either \r\n or \n)
************************** ********** ***/
$mail = new html_mime_mail(array('X-Ma iler: Html Mime Mail Class'));
/************************* ********** ****
** Read the image background.gif into
** $background
************************** ********** ***/
//$background = $mail->get_file('backgroun d.gif');
/************************* ********** ****
** Read the file test.zip into $attachment.
************************** ********** ***/
//$attachment = $mail->get_file('example.z ip');
/************************* ********** ****
** If sending an html email, then these
** two variables specify the text and
** html versions of the mail. Don't
** have to be named as these are. Just
** make sure the names tie in to the
** $mail->add_html() call further down.
************************** ********** ***/
/* _RAQ_ Create the text and HTML messages. */
$sText = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver "]}.
The pictures you want are {$HTTP_POST_VARS["pic"]}.
//and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments "]}
Thank you.
END_TEXT;
$sHtml = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei ver"]}</b> .</div>
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic"] }.</div>
//</b> and <b>{$HTTP_POST_VARS["pic2" ]}</b>
<div>Your comments are :<br><br><b>{$HTTP_POST_VA RS["commen ts"]}</b>< /div>
<div>Thank you.</div>
END_TEXT;
/* _RAQ_ Save the text and HTML messages into temporary files.
NOTE : You will need to check your servers tmp location or have adequate permissions to write to your own directory!!!
*/
$tmpText = tempnam ("/tmp", "_mail_text_");
$tmpHtml = tempnam ("/tmp", "_mail_html_");
$fp = fopen($tmpText, "w");
fwrite($fp, $sText);
fclose($fp);
$fp = fopen($tmpHtml, "w");
fwrite($fp, $sHtml);
fclose($fp);
/* Use the temporary filenames. */
$text = $mail->get_file($tmpText);
$html = $mail->get_file($tmpHtml);
/************************* ********** ****
** Add the text, html and embedded images.
** The name of the image should match exactly
** (case-sensitive) to the name in the html.
************************** ********** ***/
$mail->add_html($html, $text);
// $mail->add_html_image($bac kground, 'background.gif', 'image/gif');
/************************* ********** ****
** This is used to add an attachment to
** the email.
************************** ********** ***/
//$mail->add_attachment($a ttachment, 'example.zip', 'application/zip');
/************************* ********** ****
** Builds the message.
************************** ********** ***/
if(!$mail->build_message() )
die('Failed to build email');
/************************* ********** ****
** Send the email using smtp method.
** This is the preferred method of sending.
************************** ********** ***/
include('yyy.php');
$params = array(
'host' => 'smtp.softhome.net', // Mail server address
'port' => 25, // Mail server port
'helo' => 'mydomain.com', // Use your domain here.
'auth' => TRUE, // Whether to use authentication or not.
'user' => 'me@softhome.net', // Authentication username
'pass' => '111zzz' // Authentication password
);
$smtp =& smtp::connect($params);
$send_params = array(
'from' => 'joe@example.com', // The return path
'recipients' => 'zzzoobie@wmconnect.com', // Can be more than one address in this array.
'headers' => array(
'From: "Joe" <joe@example.com>',
'To: "Richard Heyes" <richard@[10.1.1.2]>', // A To: header is necessary, but does
'Subject: Test email' // not have to match the recipients list.
)
);
$mail->smtp_send($smtp, $send_params);
/* _RAQ_ Delete the temporary files. */
unlink($tmpText);
unlink($tmpHtml);
/************************* ********** ****
** Debug stuff. Entirely unnecessary.
************************** ********** ***/
echo '<PRE>'.htmlentities($mail ->get_rfc8 22('Richar d', 'richard@[10.1.1.2]', 'Joe', 'joe@example.com', 'Example email using HTML Mime Mail class')).'</PRE>';
?>
This is what I have so far. I've commented some things out for testing. Maybe it's that permissions you mentioned...:
<?php
/*************************
** Filename.......: example.1.php
** Project........: HTML Mime Mail class
** Last Modified..: 01 October 2001
**************************
/*
Having trouble? Read this article on HTML email: http://www.arsdigita.com/asj/mime/
*/#
error_reporting(E_ALL);
include('xxx.php');
/*************************
** Example of usage. This example shows
** how to use the class with html,
** embedded images, and an attachment,
** using the usual methods.
**************************
/*************************
** This is optional, it will default to \n
** If you're having problems, try changing
** this to either \n (unix) or \r (Mac)
**************************
define('CRLF', "\r\n", TRUE);
/*************************
** Create the mail object. Optional headers
** argument. Do not put From: here, this
** will be added when $mail->send
** Does not have to have trailing \r\n
** but if adding multiple headers, must
** be seperated by whatever you're using
** as line ending (usually either \r\n or \n)
**************************
$mail = new html_mime_mail(array('X-Ma
/*************************
** Read the image background.gif into
** $background
**************************
//$background = $mail->get_file('backgroun
/*************************
** Read the file test.zip into $attachment.
**************************
//$attachment = $mail->get_file('example.z
/*************************
** If sending an html email, then these
** two variables specify the text and
** html versions of the mail. Don't
** have to be named as these are. Just
** make sure the names tie in to the
** $mail->add_html() call further down.
**************************
/* _RAQ_ Create the text and HTML messages. */
$sText = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver
The pictures you want are {$HTTP_POST_VARS["pic"]}.
//and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments
Thank you.
END_TEXT;
$sHtml = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic"]
//</b> and <b>{$HTTP_POST_VARS["pic2"
<div>Your comments are :<br><br><b>{$HTTP_POST_VA
<div>Thank you.</div>
END_TEXT;
/* _RAQ_ Save the text and HTML messages into temporary files.
NOTE : You will need to check your servers tmp location or have adequate permissions to write to your own directory!!!
*/
$tmpText = tempnam ("/tmp", "_mail_text_");
$tmpHtml = tempnam ("/tmp", "_mail_html_");
$fp = fopen($tmpText, "w");
fwrite($fp, $sText);
fclose($fp);
$fp = fopen($tmpHtml, "w");
fwrite($fp, $sHtml);
fclose($fp);
/* Use the temporary filenames. */
$text = $mail->get_file($tmpText);
$html = $mail->get_file($tmpHtml);
/*************************
** Add the text, html and embedded images.
** The name of the image should match exactly
** (case-sensitive) to the name in the html.
**************************
$mail->add_html($html, $text);
// $mail->add_html_image($bac
/*************************
** This is used to add an attachment to
** the email.
**************************
//$mail->add_attachment($a
/*************************
** Builds the message.
**************************
if(!$mail->build_message()
die('Failed to build email');
/*************************
** Send the email using smtp method.
** This is the preferred method of sending.
**************************
include('yyy.php');
$params = array(
'host' => 'smtp.softhome.net', // Mail server address
'port' => 25, // Mail server port
'helo' => 'mydomain.com', // Use your domain here.
'auth' => TRUE, // Whether to use authentication or not.
'user' => 'me@softhome.net', // Authentication username
'pass' => '111zzz' // Authentication password
);
$smtp =& smtp::connect($params);
$send_params = array(
'from' => 'joe@example.com', // The return path
'recipients' => 'zzzoobie@wmconnect.com', // Can be more than one address in this array.
'headers' => array(
'From: "Joe" <joe@example.com>',
'To: "Richard Heyes" <richard@[10.1.1.2]>', // A To: header is necessary, but does
'Subject: Test email' // not have to match the recipients list.
)
);
$mail->smtp_send($smtp, $send_params);
/* _RAQ_ Delete the temporary files. */
unlink($tmpText);
unlink($tmpHtml);
/*************************
** Debug stuff. Entirely unnecessary.
**************************
echo '<PRE>'.htmlentities($mail
?>
The second END_TEXT;
should be
END_HTML;
Sorry. My bad.
should be
END_HTML;
Sorry. My bad.
ASKER
Yes...I removed the extra <<<'s
This is what I have so far. I've commented some things out for testing. Maybe it's that permissions you mentioned...:
<?php
/************************* ********** ****
** Filename.......: example.1.php
** Project........: HTML Mime Mail class
** Last Modified..: 01 October 2001
************************** ********** ***/
/*
Having trouble? Read this article on HTML email: http://www.arsdigita.com/asj/mime/
*/#
error_reporting(E_ALL);
include('xxx.php');
/************************* ********** ****
** Example of usage. This example shows
** how to use the class with html,
** embedded images, and an attachment,
** using the usual methods.
************************** ********** ***/
/************************* ********** ****
** This is optional, it will default to \n
** If you're having problems, try changing
** this to either \n (unix) or \r (Mac)
************************** ********** ***/
define('CRLF', "\r\n", TRUE);
/************************* ********** ****
** Create the mail object. Optional headers
** argument. Do not put From: here, this
** will be added when $mail->send
** Does not have to have trailing \r\n
** but if adding multiple headers, must
** be seperated by whatever you're using
** as line ending (usually either \r\n or \n)
************************** ********** ***/
$mail = new html_mime_mail(array('X-Ma iler: Html Mime Mail Class'));
/************************* ********** ****
** Read the image background.gif into
** $background
************************** ********** ***/
//$background = $mail->get_file('backgroun d.gif');
/************************* ********** ****
** Read the file test.zip into $attachment.
************************** ********** ***/
//$attachment = $mail->get_file('example.z ip');
/************************* ********** ****
** If sending an html email, then these
** two variables specify the text and
** html versions of the mail. Don't
** have to be named as these are. Just
** make sure the names tie in to the
** $mail->add_html() call further down.
************************** ********** ***/
/* _RAQ_ Create the text and HTML messages. */
$sText = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver "]}.
The pictures you want are {$HTTP_POST_VARS["pic"]}.
//and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments "]}
Thank you.
END_TEXT;
$sHtml = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei ver"]}</b> .</div>
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic"] }.</div>
//</b> and <b>{$HTTP_POST_VARS["pic2" ]}</b>
<div>Your comments are :<br><br><b>{$HTTP_POST_VA RS["commen ts"]}</b>< /div>
<div>Thank you.</div>
END_TEXT;
/* _RAQ_ Save the text and HTML messages into temporary files.
NOTE : You will need to check your servers tmp location or have adequate permissions to write to your own directory!!!
*/
$tmpText = tempnam ("/tmp", "_mail_text_");
$tmpHtml = tempnam ("/tmp", "_mail_html_");
$fp = fopen($tmpText, "w");
fwrite($fp, $sText);
fclose($fp);
$fp = fopen($tmpHtml, "w");
fwrite($fp, $sHtml);
fclose($fp);
/* Use the temporary filenames. */
$text = $mail->get_file($tmpText);
$html = $mail->get_file($tmpHtml);
/************************* ********** ****
** Add the text, html and embedded images.
** The name of the image should match exactly
** (case-sensitive) to the name in the html.
************************** ********** ***/
$mail->add_html($html, $text);
// $mail->add_html_image($bac kground, 'background.gif', 'image/gif');
/************************* ********** ****
** This is used to add an attachment to
** the email.
************************** ********** ***/
//$mail->add_attachment($a ttachment, 'example.zip', 'application/zip');
/************************* ********** ****
** Builds the message.
************************** ********** ***/
if(!$mail->build_message() )
die('Failed to build email');
/************************* ********** ****
** Send the email using smtp method.
** This is the preferred method of sending.
************************** ********** ***/
include('yyy.php');
$params = array(
'host' => 'smtp.softhome.net', // Mail server address
'port' => 25, // Mail server port
'helo' => 'mydomain.com', // Use your domain here.
'auth' => TRUE, // Whether to use authentication or not.
'user' => 'me@softhome.net', // Authentication username
'pass' => '111zzz' // Authentication password
);
$smtp =& smtp::connect($params);
$send_params = array(
'from' => 'joe@example.com', // The return path
'recipients' => 'zzzoobie@wmconnect.com', // Can be more than one address in this array.
'headers' => array(
'From: "Joe" <joe@example.com>',
'To: "Richard Heyes" <richard@[10.1.1.2]>', // A To: header is necessary, but does
'Subject: Test email' // not have to match the recipients list.
)
);
$mail->smtp_send($smtp, $send_params);
/* _RAQ_ Delete the temporary files. */
unlink($tmpText);
unlink($tmpHtml);
/************************* ********** ****
** Debug stuff. Entirely unnecessary.
************************** ********** ***/
echo '<PRE>'.htmlentities($mail ->get_rfc8 22('Richar d', 'richard@[10.1.1.2]', 'Joe', 'joe@example.com', 'Example email using HTML Mime Mail class')).'</PRE>';
?>
This is what I have so far. I've commented some things out for testing. Maybe it's that permissions you mentioned...:
<?php
/*************************
** Filename.......: example.1.php
** Project........: HTML Mime Mail class
** Last Modified..: 01 October 2001
**************************
/*
Having trouble? Read this article on HTML email: http://www.arsdigita.com/asj/mime/
*/#
error_reporting(E_ALL);
include('xxx.php');
/*************************
** Example of usage. This example shows
** how to use the class with html,
** embedded images, and an attachment,
** using the usual methods.
**************************
/*************************
** This is optional, it will default to \n
** If you're having problems, try changing
** this to either \n (unix) or \r (Mac)
**************************
define('CRLF', "\r\n", TRUE);
/*************************
** Create the mail object. Optional headers
** argument. Do not put From: here, this
** will be added when $mail->send
** Does not have to have trailing \r\n
** but if adding multiple headers, must
** be seperated by whatever you're using
** as line ending (usually either \r\n or \n)
**************************
$mail = new html_mime_mail(array('X-Ma
/*************************
** Read the image background.gif into
** $background
**************************
//$background = $mail->get_file('backgroun
/*************************
** Read the file test.zip into $attachment.
**************************
//$attachment = $mail->get_file('example.z
/*************************
** If sending an html email, then these
** two variables specify the text and
** html versions of the mail. Don't
** have to be named as these are. Just
** make sure the names tie in to the
** $mail->add_html() call further down.
**************************
/* _RAQ_ Create the text and HTML messages. */
$sText = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver
The pictures you want are {$HTTP_POST_VARS["pic"]}.
//and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments
Thank you.
END_TEXT;
$sHtml = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic"]
//</b> and <b>{$HTTP_POST_VARS["pic2"
<div>Your comments are :<br><br><b>{$HTTP_POST_VA
<div>Thank you.</div>
END_TEXT;
/* _RAQ_ Save the text and HTML messages into temporary files.
NOTE : You will need to check your servers tmp location or have adequate permissions to write to your own directory!!!
*/
$tmpText = tempnam ("/tmp", "_mail_text_");
$tmpHtml = tempnam ("/tmp", "_mail_html_");
$fp = fopen($tmpText, "w");
fwrite($fp, $sText);
fclose($fp);
$fp = fopen($tmpHtml, "w");
fwrite($fp, $sHtml);
fclose($fp);
/* Use the temporary filenames. */
$text = $mail->get_file($tmpText);
$html = $mail->get_file($tmpHtml);
/*************************
** Add the text, html and embedded images.
** The name of the image should match exactly
** (case-sensitive) to the name in the html.
**************************
$mail->add_html($html, $text);
// $mail->add_html_image($bac
/*************************
** This is used to add an attachment to
** the email.
**************************
//$mail->add_attachment($a
/*************************
** Builds the message.
**************************
if(!$mail->build_message()
die('Failed to build email');
/*************************
** Send the email using smtp method.
** This is the preferred method of sending.
**************************
include('yyy.php');
$params = array(
'host' => 'smtp.softhome.net', // Mail server address
'port' => 25, // Mail server port
'helo' => 'mydomain.com', // Use your domain here.
'auth' => TRUE, // Whether to use authentication or not.
'user' => 'me@softhome.net', // Authentication username
'pass' => '111zzz' // Authentication password
);
$smtp =& smtp::connect($params);
$send_params = array(
'from' => 'joe@example.com', // The return path
'recipients' => 'zzzoobie@wmconnect.com', // Can be more than one address in this array.
'headers' => array(
'From: "Joe" <joe@example.com>',
'To: "Richard Heyes" <richard@[10.1.1.2]>', // A To: header is necessary, but does
'Subject: Test email' // not have to match the recipients list.
)
);
$mail->smtp_send($smtp, $send_params);
/* _RAQ_ Delete the temporary files. */
unlink($tmpText);
unlink($tmpHtml);
/*************************
** Debug stuff. Entirely unnecessary.
**************************
echo '<PRE>'.htmlentities($mail
?>
ASKER
Warning: Undefined index: pic2 in /www/php50.com/html/zoobie /send.php on line 74
Warning: Undefined index: pic2 in /www/php50.com/html/zoobie /send.php on line 88
Warning: open_basedir restriction in effect. File is in wrong directory in /www/php50.com/html/zoobie /send.php on line 99
Warning: fopen("/tmp/_mail_text_nvb Kuf","w") - Operation not permitted in /www/php50.com/html/zoobie /send.php on line 99
Warning: Supplied argument is not a valid File-Handle resource in /www/php50.com/html/zoobie /send.php on line 100
Warning: Supplied argument is not a valid File-Handle resource in /www/php50.com/html/zoobie /send.php on line 101
Warning: open_basedir restriction in effect. File is in wrong directory in /www/php50.com/html/zoobie /send.php on line 102
Warning: fopen("/tmp/_mail_html_v5s x1X","w") - Operation not permitted in /www/php50.com/html/zoobie /send.php on line 102
Warning: Supplied argument is not a valid File-Handle resource in /www/php50.com/html/zoobie /send.php on line 103
Warning: Supplied argument is not a valid File-Handle resource in /www/php50.com/html/zoobie /send.php on line 104
Warning: open_basedir restriction in effect. File is in wrong directory in /www/php50.com/html/zoobie /xxx.php on line 104 (this is class.mime.mail.php)
Warning: fopen("/tmp/_mail_text_nvb Kuf","rb") - Operation not permitted in /www/php50.com/html/zoobie /xxx.php on line 104 (this is class.mime.mail.php)
Warning: open_basedir restriction in effect. File is in wrong directory in /www/php50.com/html/zoobie /xxx.php on line 104 (this is class.mime.mail.php)
Warning: fopen("/tmp/_mail_html_v5s x1X","rb") - Operation not permitted in /www/php50.com/html/zoobie /xxx.php on line 104 (this is class.mime.mail.php)
Failed to build email
Warning: Undefined index: pic2 in /www/php50.com/html/zoobie
Warning: open_basedir restriction in effect. File is in wrong directory in /www/php50.com/html/zoobie
Warning: fopen("/tmp/_mail_text_nvb
Warning: Supplied argument is not a valid File-Handle resource in /www/php50.com/html/zoobie
Warning: Supplied argument is not a valid File-Handle resource in /www/php50.com/html/zoobie
Warning: open_basedir restriction in effect. File is in wrong directory in /www/php50.com/html/zoobie
Warning: fopen("/tmp/_mail_html_v5s
Warning: Supplied argument is not a valid File-Handle resource in /www/php50.com/html/zoobie
Warning: Supplied argument is not a valid File-Handle resource in /www/php50.com/html/zoobie
Warning: open_basedir restriction in effect. File is in wrong directory in /www/php50.com/html/zoobie
Warning: fopen("/tmp/_mail_text_nvb
Warning: open_basedir restriction in effect. File is in wrong directory in /www/php50.com/html/zoobie
Warning: fopen("/tmp/_mail_html_v5s
Failed to build email
ASKER
Can't we just pass the variables into the example.html or doesn't it work that way?
ASKER
Can't we just pass the variables into the example.html or doesn't it work that way?
Your server will only allow you open files from a specific directory (I think) - Warning: open_basedir restriction in effect - speak to your sysop for this setting, or check out phpinfo();
-------info.php--------
<?php
phpinfo();
?>
-------info.php--------
This will show you the settings you have.
You will need to change "/tmp" to a directory you DO have read/write access to. Ask your sysop for that. Try using "./" instead of "/tmp".
As you can't write the files, you can't open them either, so this is a lof of those errors.
To add inline images, try ...
<images src='cid:{$HTTP_POST_VARS[ "pic"]}'>
in the HTML part and
use the add attachement method to add $HTTP_POST_VARS["pic"] to the list.
Make sure you add the correct extension to this too as the list seems to only contain the NAME and not the extension (gif/jpg/etc).
Richard.
-------info.php--------
<?php
phpinfo();
?>
-------info.php--------
This will show you the settings you have.
You will need to change "/tmp" to a directory you DO have read/write access to. Ask your sysop for that. Try using "./" instead of "/tmp".
As you can't write the files, you can't open them either, so this is a lof of those errors.
To add inline images, try ...
<images src='cid:{$HTTP_POST_VARS[
in the HTML part and
use the add attachement method to add $HTTP_POST_VARS["pic"] to the list.
Make sure you add the correct extension to this too as the list seems to only contain the NAME and not the extension (gif/jpg/etc).
Richard.
ASKER
Close...
Ok...I changed /temp to ./ and it's writing. I've also added
$attachment = $mail->get_file('$HTTP_POS T_VARS["pi c".gif]'); but this throwing the error below.
I'm getting this echo:
Warning: Unable to access $HTTP_POST_VARS["pic".gif] in /www/php50.com/html/zoobie /xxx.php on line 104 (this is class.mime.mail.php)
Warning: fopen("$HTTP_POST_VARS["pi c".gif]"," rb") - No such file or directory in /www/php50.com/html/zoobie /xxx.php on line 104 (this is class.mime.mail.php)
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie /send.php on line 162
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie /send.php on line 163
Date: Fri, 19 Jul 02 19:29:38
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_e6d01c8aa5df5f cb5f2b1805 de9a43b8"
--=_e6d01c8aa5df5fcb5f2b18 05de9a43b8
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello.
This is a plain text email.
You want to send this email to zzzoobie@wmconnect.com.
The pictures you want are smiley.gif and smiley.gif .
Your comments are :
aol test 5
Thank you.
--=_e6d01c8aa5df5fcb5f2b18 05de9a43b8
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>zzzoobie@wmconnect.com< /b>.</div>
<div>The pictures you want are <img src=3D'cid:smiley.gif'> and <img src=3D=
'cid:smiley.gif'>.</div>
<div>Your comments are :<br><br><b>aol test 5</b></div>
<div>Thank you.</div>
--=_e6d01c8aa5df5fcb5f2b18 05de9a43b8 --
Ok...I changed /temp to ./ and it's writing. I've also added
$attachment = $mail->get_file('$HTTP_POS
I'm getting this echo:
Warning: Unable to access $HTTP_POST_VARS["pic".gif]
Warning: fopen("$HTTP_POST_VARS["pi
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie
Date: Fri, 19 Jul 02 19:29:38
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_e6d01c8aa5df5f
--=_e6d01c8aa5df5fcb5f2b18
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding:
Hello.
This is a plain text email.
You want to send this email to zzzoobie@wmconnect.com.
The pictures you want are smiley.gif and smiley.gif .
Your comments are :
aol test 5
Thank you.
--=_e6d01c8aa5df5fcb5f2b18
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding:
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>zzzoobie@wmconnect.com<
<div>The pictures you want are <img src=3D'cid:smiley.gif'> and <img src=3D=
'cid:smiley.gif'>.</div>
<div>Your comments are :<br><br><b>aol test 5</b></div>
<div>Thank you.</div>
--=_e6d01c8aa5df5fcb5f2b18
ASKER
Close...
Ok...I changed /temp to ./ and it's writing. I've also added
$attachment = $mail->get_file('$HTTP_POS T_VARS["pi c".gif]'); but this throwing the error below.
I'm getting this echo:
Warning: Unable to access $HTTP_POST_VARS["pic".gif] in /www/php50.com/html/zoobie /xxx.php on line 104 (this is class.mime.mail.php)
Warning: fopen("$HTTP_POST_VARS["pi c".gif]"," rb") - No such file or directory in /www/php50.com/html/zoobie /xxx.php on line 104 (this is class.mime.mail.php)
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie /send.php on line 162
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie /send.php on line 163
Date: Fri, 19 Jul 02 19:29:38
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_e6d01c8aa5df5f cb5f2b1805 de9a43b8"
--=_e6d01c8aa5df5fcb5f2b18 05de9a43b8
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello.
This is a plain text email.
You want to send this email to zzzoobie@wmconnect.com.
The pictures you want are smiley.gif and smiley.gif .
Your comments are :
aol test 5
Thank you.
--=_e6d01c8aa5df5fcb5f2b18 05de9a43b8
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>zzzoobie@wmconnect.com< /b>.</div>
<div>The pictures you want are <img src=3D'cid:smiley.gif'> and <img src=3D=
'cid:smiley.gif'>.</div>
<div>Your comments are :<br><br><b>aol test 5</b></div>
<div>Thank you.</div>
--=_e6d01c8aa5df5fcb5f2b18 05de9a43b8 --
Ok...I changed /temp to ./ and it's writing. I've also added
$attachment = $mail->get_file('$HTTP_POS
I'm getting this echo:
Warning: Unable to access $HTTP_POST_VARS["pic".gif]
Warning: fopen("$HTTP_POST_VARS["pi
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie
Date: Fri, 19 Jul 02 19:29:38
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_e6d01c8aa5df5f
--=_e6d01c8aa5df5fcb5f2b18
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding:
Hello.
This is a plain text email.
You want to send this email to zzzoobie@wmconnect.com.
The pictures you want are smiley.gif and smiley.gif .
Your comments are :
aol test 5
Thank you.
--=_e6d01c8aa5df5fcb5f2b18
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding:
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>zzzoobie@wmconnect.com<
<div>The pictures you want are <img src=3D'cid:smiley.gif'> and <img src=3D=
'cid:smiley.gif'>.</div>
<div>Your comments are :<br><br><b>aol test 5</b></div>
<div>Thank you.</div>
--=_e6d01c8aa5df5fcb5f2b18
Try
$HTTP_POST_VARS["pic1"] . ".gif"
The $HTTP_POST_VARS["pic1"] gives you the name and then you add the extension to it.
So if pic1 contains fred ...
$HTTP_POST_VARS["pic1"] . ".gif"
>
"fred" . ".gif"
>
"fred.gif"
The unlink error is your system. I would suggest you talk you your sysop and ask them to give you a read/write directory and allow you to unlink files from that directory. If they do, then you will need to change the "\tmp" to the directory they give you.
Alternatively, if they have a scratch area which is cleaned out hourly, daily, etc, then that can be used. If so, then you can remove the unlink command as the system will clean files out anyway. Not a lot you can do about this until you've spoken to your sysop.
When you receive the email, do you get a placeholder for the images?
Richard.
$HTTP_POST_VARS["pic1"] . ".gif"
The $HTTP_POST_VARS["pic1"] gives you the name and then you add the extension to it.
So if pic1 contains fred ...
$HTTP_POST_VARS["pic1"] . ".gif"
>
"fred" . ".gif"
>
"fred.gif"
The unlink error is your system. I would suggest you talk you your sysop and ask them to give you a read/write directory and allow you to unlink files from that directory. If they do, then you will need to change the "\tmp" to the directory they give you.
Alternatively, if they have a scratch area which is cleaned out hourly, daily, etc, then that can be used. If so, then you can remove the unlink command as the system will clean files out anyway. Not a lot you can do about this until you've spoken to your sysop.
When you receive the email, do you get a placeholder for the images?
Richard.
ASKER
The error says it's expecting another "}" in this line:
The picture you want is {$HTTP_POST_VARS["pic1"] . ".gif"}
but I've tried putting it everywhere.
And no...the placeholders don't show up because the mail isn't being sent.
I also found another example:
/************************* ********** ****
** Add the text, html and embedded images.
** Here we're using the third argument of
** add_html(), which is the path to the
** directory that holds the images. By
** adding this third argument, the class
** will try to find all the images in the
** html, and auto load them in. Not 100%
** accurate, and you MUST enclose your
** image references in quotes, so src="img.jpg"
** and NOT src=img.jpg. Also, where possible,
** duplicates will be avoided.
************************** ********** ***/
$mail->add_html($html, $text, './');
The problem is, the above method is used via mail() rather than smtp which I'm using and includes another the smtp.mime.php file.
Could we use this?
The picture you want is {$HTTP_POST_VARS["pic1"] . ".gif"}
but I've tried putting it everywhere.
And no...the placeholders don't show up because the mail isn't being sent.
I also found another example:
/*************************
** Add the text, html and embedded images.
** Here we're using the third argument of
** add_html(), which is the path to the
** directory that holds the images. By
** adding this third argument, the class
** will try to find all the images in the
** html, and auto load them in. Not 100%
** accurate, and you MUST enclose your
** image references in quotes, so src="img.jpg"
** and NOT src=img.jpg. Also, where possible,
** duplicates will be avoided.
**************************
$mail->add_html($html, $text, './');
The problem is, the above method is used via mail() rather than smtp which I'm using and includes another the smtp.mime.php file.
Could we use this?
ASKER
The error says it's expecting another "}" in this line:
The picture you want is {$HTTP_POST_VARS["pic1"] . ".gif"}
but I've tried putting it everywhere.
And no...the placeholders don't show up because the mail isn't being sent.
I also found another example:
/************************* ********** ****
** Add the text, html and embedded images.
** Here we're using the third argument of
** add_html(), which is the path to the
** directory that holds the images. By
** adding this third argument, the class
** will try to find all the images in the
** html, and auto load them in. Not 100%
** accurate, and you MUST enclose your
** image references in quotes, so src="img.jpg"
** and NOT src=img.jpg. Also, where possible,
** duplicates will be avoided.
************************** ********** ***/
$mail->add_html($html, $text, './');
The problem is, the above method is used via mail() rather than smtp which I'm using and includes another the smtp.mime.php file.
Could we use this?
The picture you want is {$HTTP_POST_VARS["pic1"] . ".gif"}
but I've tried putting it everywhere.
And no...the placeholders don't show up because the mail isn't being sent.
I also found another example:
/*************************
** Add the text, html and embedded images.
** Here we're using the third argument of
** add_html(), which is the path to the
** directory that holds the images. By
** adding this third argument, the class
** will try to find all the images in the
** html, and auto load them in. Not 100%
** accurate, and you MUST enclose your
** image references in quotes, so src="img.jpg"
** and NOT src=img.jpg. Also, where possible,
** duplicates will be avoided.
**************************
$mail->add_html($html, $text, './');
The problem is, the above method is used via mail() rather than smtp which I'm using and includes another the smtp.mime.php file.
Could we use this?
Ah.
Ok.
The use of {} inside a heredoc (the <<< stuff) restricts what can actually be created.
You will need to produce 2 new variables OUTSIDE of that part of the code.
Just above the $sText creation add ...
$sPic1 = $HTTP_POST_VARS["pic1"] . ".gif";
$sPic2 = $HTTP_POST_VARS["pic2"] . ".gif";
And replace the
{$HTTP_POST_VARS["pic1"]}
in the heredoc with
$sPic1
Repeat for the second pic.
Richard.
Ok.
The use of {} inside a heredoc (the <<< stuff) restricts what can actually be created.
You will need to produce 2 new variables OUTSIDE of that part of the code.
Just above the $sText creation add ...
$sPic1 = $HTTP_POST_VARS["pic1"] . ".gif";
$sPic2 = $HTTP_POST_VARS["pic2"] . ".gif";
And replace the
{$HTTP_POST_VARS["pic1"]}
in the heredoc with
$sPic1
Repeat for the second pic.
Richard.
ASKER
Warning: Unable to access $HTTP_POST_VARS["pic"] . ".gif" in /www/php50.com/html/zoobie /class.htm l.mime.mai l.php on line 104
Warning: fopen("$HTTP_POST_VARS["pi c"] . ".gif"","rb") - No such file or directory in /www/php50.com/html/zoobie /class.htm l.mime.mai l.php on line 104
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie /zmail2.ph p on line 168
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie /zmail2.ph p on line 169
Date: Mon, 22 Jul 02 15:49:34
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_1a446825fe93c6 f18dd8d600 218b1a42"
--=_1a446825fe93c6f18dd8d6 00218b1a42
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello.
This is a plain text email.
You want to send this email to zzzoobie@wmconnect.com.
The pictures you want are smiley.gif and smiley.gif .
Your comments are :
aol test 87459487564785683847563
Thank you.
--=_1a446825fe93c6f18dd8d6 00218b1a42
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>zzzoobie@wmconnect.com< /b>.</div>
<div>The pictures you want are <img src=3D'cid:smiley.gif'> and <img src=3D=
'cid:smiley.gif'>.</div>
<div>Your comments are :<br><br><b>aol test 87459487564785683847563</b ></di=
v>
<div>Thank you.</div>
--=_1a446825fe93c6f18dd8d6 00218b1a42 --
Warning: fopen("$HTTP_POST_VARS["pi
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie
Warning: unlink() has been disabled for security reasons. in /www/php50.com/html/zoobie
Date: Mon, 22 Jul 02 15:49:34
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_1a446825fe93c6
--=_1a446825fe93c6f18dd8d6
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding:
Hello.
This is a plain text email.
You want to send this email to zzzoobie@wmconnect.com.
The pictures you want are smiley.gif and smiley.gif .
Your comments are :
aol test 87459487564785683847563
Thank you.
--=_1a446825fe93c6f18dd8d6
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding:
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>zzzoobie@wmconnect.com<
<div>The pictures you want are <img src=3D'cid:smiley.gif'> and <img src=3D=
'cid:smiley.gif'>.</div>
<div>Your comments are :<br><br><b>aol test 87459487564785683847563</b
v>
<div>Thank you.</div>
--=_1a446825fe93c6f18dd8d6
What have you done?
Can you show me your current code again.
The line ...
fopen("$HTTP_POST_VARS["pi c"] . ".gif"","rb")
is totally wrong!!
This should be ...
fopen($HTTP_POST_VARS["pic "] . ".gif","rb")
The . command adds text strings together.
Inside " . " this is just a dot with 2 spaces. It won't do anything.
Can you try (repeated) ...
The use of {} inside a heredoc (the <<< stuff) restricts what can actually be created.
You will need to produce 2 new variables OUTSIDE of that part of the code.
Just above the $sText creation add ...
$sPic1 = $HTTP_POST_VARS["pic1"] . ".gif";
$sPic2 = $HTTP_POST_VARS["pic2"] . ".gif";
And replace the
{$HTTP_POST_VARS["pic1"]}
in the heredoc with
$sPic1
Repeat for the second pic.
Richard.
Can you show me your current code again.
The line ...
fopen("$HTTP_POST_VARS["pi
is totally wrong!!
This should be ...
fopen($HTTP_POST_VARS["pic
The . command adds text strings together.
Inside " . " this is just a dot with 2 spaces. It won't do anything.
Can you try (repeated) ...
The use of {} inside a heredoc (the <<< stuff) restricts what can actually be created.
You will need to produce 2 new variables OUTSIDE of that part of the code.
Just above the $sText creation add ...
$sPic1 = $HTTP_POST_VARS["pic1"] . ".gif";
$sPic2 = $HTTP_POST_VARS["pic2"] . ".gif";
And replace the
{$HTTP_POST_VARS["pic1"]}
in the heredoc with
$sPic1
Repeat for the second pic.
Richard.
ASKER
It's putting in the extra double quotes on it's own by referencing the class.html.mime.mail.php
Not only that...but I can't be asking an already paranoid host for special permissons.
Sorry...but I just don't think this way is gonna work.
How about using the third arguement ('./') and put <img src=$HTTP_POST_VARS["pic1" ] . ".gif"> or just <img src="cid:$pic.gif"> in the example.html page?
I kind of find it hard to believe there isn't some easier way than asking permissions, writing temp files, etc.
I appreciate your help.
Not only that...but I can't be asking an already paranoid host for special permissons.
Sorry...but I just don't think this way is gonna work.
How about using the third arguement ('./') and put <img src=$HTTP_POST_VARS["pic1"
I kind of find it hard to believe there isn't some easier way than asking permissions, writing temp files, etc.
I appreciate your help.
The class you are using wants FILES not TEXT. If you can amend the class to accept the text then you don't need to write the files.
I assume that the class opens the file and reads lines from it. You could replace that with the created $sText and $sHTML variables.
That would require a bit more work.
You can try ...
<img src='{$HTTP_POST_VARS["pic 1"]}.gif'>
I think the mixing of single and double quotes is getting a little out of hand <grin> (I have to use a colour editor which shows them up nicely).
If the name sent in pic1 is FOO, then above line SHOULD result in ...
<img src='foo.gif'>
which is totally valid.
Richard.
I assume that the class opens the file and reads lines from it. You could replace that with the created $sText and $sHTML variables.
That would require a bit more work.
You can try ...
<img src='{$HTTP_POST_VARS["pic
I think the mixing of single and double quotes is getting a little out of hand <grin> (I have to use a colour editor which shows them up nicely).
If the name sent in pic1 is FOO, then above line SHOULD result in ...
<img src='foo.gif'>
which is totally valid.
Richard.
ASKER
Let's try just one image for now.
I used the very simple third arguement where it finds and inserts the file (a few posts back) in the example.html and it still spit out:
Warning: Unable to access {$HTTP_POST_VARS["pic"]}.g if in /www/php50.com/html/zoobie /class.htm l.mime.mai l.php on line 106
Warning: fopen("{$HTTP_POST_VARS["p ic"]}.gif" ,"rb") - No such file or directory in /www/php50.com/html/zoobie /class.htm l.mime.mai l.php on line 106
...but it looks like it will work. That way, we don't need to ask permissions or write files.
The <img src='{$HTTP_POST_VARS["pic "]}.gif'> isn't receiving the passed file either.
Tell you what...Why don't you go to http://www.phpguru.org/mime.mail.html and d/l the script complete with examples and work on it. When you get it solved, I'll give you 400 points. I need to send the email via SMTP method (example 1 & 2).
Need a free test host? http://www.php50.com is using v4.0.6
What say?
Thanks
I used the very simple third arguement where it finds and inserts the file (a few posts back) in the example.html and it still spit out:
Warning: Unable to access {$HTTP_POST_VARS["pic"]}.g
Warning: fopen("{$HTTP_POST_VARS["p
...but it looks like it will work. That way, we don't need to ask permissions or write files.
The <img src='{$HTTP_POST_VARS["pic
Tell you what...Why don't you go to http://www.phpguru.org/mime.mail.html and d/l the script complete with examples and work on it. When you get it solved, I'll give you 400 points. I need to send the email via SMTP method (example 1 & 2).
Need a free test host? http://www.php50.com is using v4.0.6
What say?
Thanks
-----input.html----------- --
<html>
<head>
<title>Test Email</title>
</head>
<body>
<form method="POST" action="mailtest.php">
What is your email address <input type="text" name="receiver"><br>
Choose your first picture <select name="pic1">
<option value="pic1.gif">Pic1 (gif)
<option value="pic2.gif">Pic2 (gif)
<option value="pic3.gif">Pic3 (gif)
<option value="pic4.gif">Pic4 (gif)
<option value="pic5.gif">Pic5 (gif)
</select><br>
Choose your second picture <select name="pic2">
<option value="pic1.jpg">Pic1 (jpeg)
<option value="pic2.jpg">Pic2 (jpeg)
<option value="pic3.jpg">Pic3 (jpeg)
<option value="pic4.jpg">Pic4 (jpeg)
<option value="pic5.jpg">Pic5 (jpeg)
</select><br>
<textarea rows="5" cols="60" name="comments"></textarea ><br>
<input type="submit" name="Send Email" value="Send Email">
</form>
</body>
</html>
--------------mailtest.php ---------- ------
<?php
error_reporting(E_ALL);
include('htmlMimeMail.php' );
$mail = new htmlMimeMail();
$text = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver "]}.
The pictures you want are {$HTTP_POST_VARS["pic1"]} and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments "]}
Thank you.
END_TEXT;
$html = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei ver"]}</b> .</div>
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic1" ]}</b> and <b>{$HTTP_POST_VARS["pic2" ]}</b>.</d iv>
<div>These images are <img src="cid:{$HTTP_POST_VARS[ "pic1"]}"> and <img src="cid:{$HTTP_POST_VARS[ "pic2"]}"> .</div>
<div>Your comments are :<br><br><b>{$HTTP_POST_VA RS["commen ts"]}</b>< /div>
<div>Thank you.</div>
END_HTML;
$mail->setHtml($html, $text);
$mail->setFrom('"Richard" <Richard@example.com>');
$mail->setSubject('Test mail');
$mail->setHeader('X-Mailer ', 'HTML Mime mail class (http://www.phpguru.org)');
$result = $mail->send(array('postmas ter@localh ost'), 'smtp');
if (!$result)
{
print_r($mail->errors);
}
else
{
echo 'Mail sent!';
}
?>
<html>
<head>
<title>Test Email</title>
</head>
<body>
<form method="POST" action="mailtest.php">
What is your email address <input type="text" name="receiver"><br>
Choose your first picture <select name="pic1">
<option value="pic1.gif">Pic1 (gif)
<option value="pic2.gif">Pic2 (gif)
<option value="pic3.gif">Pic3 (gif)
<option value="pic4.gif">Pic4 (gif)
<option value="pic5.gif">Pic5 (gif)
</select><br>
Choose your second picture <select name="pic2">
<option value="pic1.jpg">Pic1 (jpeg)
<option value="pic2.jpg">Pic2 (jpeg)
<option value="pic3.jpg">Pic3 (jpeg)
<option value="pic4.jpg">Pic4 (jpeg)
<option value="pic5.jpg">Pic5 (jpeg)
</select><br>
<textarea rows="5" cols="60" name="comments"></textarea
<input type="submit" name="Send Email" value="Send Email">
</form>
</body>
</html>
--------------mailtest.php
<?php
error_reporting(E_ALL);
include('htmlMimeMail.php'
$mail = new htmlMimeMail();
$text = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver
The pictures you want are {$HTTP_POST_VARS["pic1"]} and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments
Thank you.
END_TEXT;
$html = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic1"
<div>These images are <img src="cid:{$HTTP_POST_VARS[
<div>Your comments are :<br><br><b>{$HTTP_POST_VA
<div>Thank you.</div>
END_HTML;
$mail->setHtml($html, $text);
$mail->setFrom('"Richard" <Richard@example.com>');
$mail->setSubject('Test mail');
$mail->setHeader('X-Mailer
$result = $mail->send(array('postmas
if (!$result)
{
print_r($mail->errors);
}
else
{
echo 'Mail sent!';
}
?>
ASKER
Ugh...just updated...just my luck.
I had to search thru 4 files just to find the username and password settings...Still haven't found how to set where it gets sent.
It's all in ascii....don't know if I'm actually going to be able to set this...
I had to search thru 4 files just to find the username and password settings...Still haven't found how to set where it gets sent.
It's all in ascii....don't know if I'm actually going to be able to set this...
ASKER
Ugh...just updated...just my luck.
I had to search thru 4 files just to find the username and password settings...Still haven't found how to set where it gets sent.
It's all in ascii....don't know if I'm actually going to be able to set this...
I had to search thru 4 files just to find the username and password settings...Still haven't found how to set where it gets sent.
It's all in ascii....don't know if I'm actually going to be able to set this...
ASKER
Wait...I see it.
$mail->setSMTPParams('smtp .softhome. net', 25, "php50.com', TRUE, 'me@softhome.net', '12321');
$result = $mail->send(array('zzzoobi e@wmconnec t.com'), 'smtp');
Working...
$mail->setSMTPParams('smtp
$result = $mail->send(array('zzzoobi
Working...
ASKER
Warning: dirname() has been disabled for security reasons. in /www/php50.com/html/zoobie /htmlMimeM ail.php on line 10
Warning: Unable to access /mimePart.php in /www/php50.com/html/zoobie /htmlMimeM ail.php on line 10
Fatal error: Failed opening required '/mimePart.php' (include_path='.:/usr/shar e/php') in /www/php50.com/html/zoobie /htmlMimeM ail.php on line 10
Line #10=require_once(dirname(_ _FILE__) . '/mimePart.php');
Warning: Unable to access /mimePart.php in /www/php50.com/html/zoobie
Fatal error: Failed opening required '/mimePart.php' (include_path='.:/usr/shar
Line #10=require_once(dirname(_
Unfortunately, it seems like your server is not set up to allow you to use all the functions of PHP.
This is probably VERY common on servers where the ISP is worried about potential abuse.
Also, PEAR does not seem to be pathed in properly. I suspect you will not be able to do much about that.
Sorry.
Show the script to your ISP and ask them to allow it to run. They can either say yes or no. If no, then you would be advised to change to a different ISP.
Richard.
This is probably VERY common on servers where the ISP is worried about potential abuse.
Also, PEAR does not seem to be pathed in properly. I suspect you will not be able to do much about that.
Sorry.
Show the script to your ISP and ask them to allow it to run. They can either say yes or no. If no, then you would be advised to change to a different ISP.
Richard.
ASKER
Well, I'll be...
He changed the code. I tried it at another host and it doesn't work there either.
Would it work with the previous version in the links given in my first post?
The SMTP worked fine with the earlier version...
He changed the code. I tried it at another host and it doesn't work there either.
Would it work with the previous version in the links given in my first post?
The SMTP worked fine with the earlier version...
I've not fully explored PEAR, so I can't answer that.
The pear code is standard, but if there are security issues, then these can only be resolved by talking to the ISP.
Richard.
The pear code is standard, but if there are security issues, then these can only be resolved by talking to the ISP.
Richard.
ASKER
Well, I'll be...
He changed the code. I tried it at another host and it doesn't work there either.
Would it work with the previous version in the links given in my first post?
The SMTP worked fine with the earlier version...
He changed the code. I tried it at another host and it doesn't work there either.
Would it work with the previous version in the links given in my first post?
The SMTP worked fine with the earlier version...
ASKER
I have the older version...Want to take a crack at that? I could send it...I do know the earlier version sent everything fine and he didn't use the dirname()
What happens if you use my scripts with the older class?
What errors do you get then?
What errors do you get then?
ASKER
With the old, I keep getting the Warning: Unable to access $HTTP_POST_VARS["pic"] . ".gif"
I've also bookmarked about 10 free php sites, too.
I've also bookmarked about 10 free php sites, too.
You need to use the 2 files I created. That is the old one.
Here they are again ...
-----input.html----------- --
<html>
<head>
<title>Test Email</title>
</head>
<body>
<form method="POST" action="mailtest.php">
What is your email address <input type="text" name="receiver"><br>
Choose your first picture <select name="pic1">
<option value="pic1.gif">Pic1 (gif)
<option value="pic2.gif">Pic2 (gif)
<option value="pic3.gif">Pic3 (gif)
<option value="pic4.gif">Pic4 (gif)
<option value="pic5.gif">Pic5 (gif)
</select><br>
Choose your second picture <select name="pic2">
<option value="pic1.jpg">Pic1 (jpeg)
<option value="pic2.jpg">Pic2 (jpeg)
<option value="pic3.jpg">Pic3 (jpeg)
<option value="pic4.jpg">Pic4 (jpeg)
<option value="pic5.jpg">Pic5 (jpeg)
</select><br>
<textarea rows="5" cols="60" name="comments"></textarea ><br>
<input type="submit" name="Send Email" value="Send Email">
</form>
</body>
</html>
--------------mailtest.php ---------- ------
<?php
error_reporting(E_ALL);
include('htmlMimeMail.php' );
$mail = new htmlMimeMail();
$text = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver "]}.
The pictures you want are {$HTTP_POST_VARS["pic1"]} and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments "]}
Thank you.
END_TEXT;
$html = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei ver"]}</b> .</div>
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic1" ]}</b> and <b>{$HTTP_POST_VARS["pic2" ]}</b>.</d iv>
<div>These images are <img src="cid:{$HTTP_POST_VARS[ "pic1"]}"> and <img src="cid:{$HTTP_POST_VARS[ "pic2"]}"> .</div>
<div>Your comments are :<br><br><b>{$HTTP_POST_VA RS["commen ts"]}</b>< /div>
<div>Thank you.</div>
END_HTML;
$mail->setHtml($html, $text);
$mail->setFrom('"Richard" <Richard@example.com>');
$mail->setSubject('Test mail');
$mail->setHeader('X-Mailer ', 'HTML Mime mail class (http://www.phpguru.org)');
$result = $mail->send(array('postmas ter@localh ost'), 'smtp');
if (!$result)
{
print_r($mail->errors);
}
else
{
echo 'Mail sent!';
}
?>
Use these and tell me what happens.
Here they are again ...
-----input.html-----------
<html>
<head>
<title>Test Email</title>
</head>
<body>
<form method="POST" action="mailtest.php">
What is your email address <input type="text" name="receiver"><br>
Choose your first picture <select name="pic1">
<option value="pic1.gif">Pic1 (gif)
<option value="pic2.gif">Pic2 (gif)
<option value="pic3.gif">Pic3 (gif)
<option value="pic4.gif">Pic4 (gif)
<option value="pic5.gif">Pic5 (gif)
</select><br>
Choose your second picture <select name="pic2">
<option value="pic1.jpg">Pic1 (jpeg)
<option value="pic2.jpg">Pic2 (jpeg)
<option value="pic3.jpg">Pic3 (jpeg)
<option value="pic4.jpg">Pic4 (jpeg)
<option value="pic5.jpg">Pic5 (jpeg)
</select><br>
<textarea rows="5" cols="60" name="comments"></textarea
<input type="submit" name="Send Email" value="Send Email">
</form>
</body>
</html>
--------------mailtest.php
<?php
error_reporting(E_ALL);
include('htmlMimeMail.php'
$mail = new htmlMimeMail();
$text = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver
The pictures you want are {$HTTP_POST_VARS["pic1"]} and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments
Thank you.
END_TEXT;
$html = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic1"
<div>These images are <img src="cid:{$HTTP_POST_VARS[
<div>Your comments are :<br><br><b>{$HTTP_POST_VA
<div>Thank you.</div>
END_HTML;
$mail->setHtml($html, $text);
$mail->setFrom('"Richard" <Richard@example.com>');
$mail->setSubject('Test mail');
$mail->setHeader('X-Mailer
$result = $mail->send(array('postmas
if (!$result)
{
print_r($mail->errors);
}
else
{
echo 'Mail sent!';
}
?>
Use these and tell me what happens.
ASKER
Well, it looks like he changed most of the classes with the new update. I'll try your code with the mail->addhtml($html,$text) ; bit...
I noticed that this host is ultra consertive so I'll open a few new accounts today and try it there.
I noticed that this host is ultra consertive so I'll open a few new accounts today and try it there.
ASKER
Richard -
Hey...For the first time, I got it to work without any errors using your code and the earlier version.
I used:
<?php
error_reporting(E_ALL);
include('class.html.mime.m ail.php');
define('CRLF', "\r\n", TRUE);
$mail = new html_mime_mail(array('X-Ma iler: Html Mime Mail Class'));
$text = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver "]}.
The pictures you want are {$HTTP_POST_VARS["pic1"]} and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments "]}
Thank you.
END_TEXT;
$html = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei ver"]}</b> .</div>
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic1" ]}</b> and <b>{$HTTP_POST_VARS["pic2" ]}</b>.</d iv>
<div>These images are <img src="cid:{$HTTP_POST_VARS[ "pic1"]}"> and <img src="cid:{$HTTP_POST_VARS[ "pic2"]}"> .</div>
<div>Your comments are :<br><br><b>{$HTTP_POST_VA RS["commen ts"]}</b>< /div>
<div>Thank you.</div>
END_HTML;
$mail->add_html($html, $text);
if(!$mail->build_message() )
die('Failed to build email');
include('class.smtp.php');
$params = array(
'host' => 'smtp.softhome.net', // Mail server address
'port' => 25, // Mail server port
'helo' => 'mydomain.com', // Use your domain here.
'auth' => TRUE, // Whether to use authentication or not.
'user' => 'me@softhome.net', // Authentication username
'pass' => 'zzz1zzz' // Authentication password
);
$smtp =& smtp::connect($params);
$send_params = array(
'from' => 'joe@example.com', // The return path
'recipients' => 'zzzoobie@wmconnect.com', // Can be more than one address in this array.
'headers' => array(
'From: "Joe" <joe@example.com>',
'To: "Richard Heyes" <richard@[10.1.1.2]>', // A To: header is necessary, but does
'Subject: Test email' // not have to match the recipients list.
)
);
$mail->smtp_send($smtp, $send_params);
/************************* ********** ****
** Debug stuff. Entirely unnecessary.
************************** ********** ***/
echo '<PRE>'.htmlentities($mail ->get_rfc8 22('Richar d', 'zzzoobie@wmconnect.com', 'Joe', 'joe@example.com', 'Example email using HTML Mime Mail class')).'</PRE>';
?>
...which yielded:
Date: Fri, 26 Jul 02 02:57:39
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_985d26989b0481 dcd5303c2b 69699739"
--=_985d26989b0481dcd5303c 2b69699739
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello.
This is a plain text email.
You want to send this email to you@doofus.com.
The pictures you want are alfred.gif and smiley.gif.
Your comments are :
ok...my test text
Thank you../
--=_985d26989b0481dcd5303c 2b69699739
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>you@doofus.com</b>.</di v>
<div>The pictures you want are <b>alfred.gif</b> and <b>smiley.gif</b>.</di=
v>
<div>These images are <img src=3D"cid:alfred.gif"> and <img src=3D"cid:smil=
ey.gif">.</div>
<div>Your comments are :<br><br><b>ok...my test text</b></div>
<div>Thank you.</div>
--=_985d26989b0481dcd5303c 2b69699739 --
It's echoing...but not really sending unles my email is down now.
What it's missing is the passing of the variable into these:
$background = $mail->get_file('backgroun d.gif');
$mail->add_html_image($bac kground, 'background.gif', 'image/gif');
Maybe we could change the $background bit above...but if I remember correctly, it doesn't want to get that file.
Hey...For the first time, I got it to work without any errors using your code and the earlier version.
I used:
<?php
error_reporting(E_ALL);
include('class.html.mime.m
define('CRLF', "\r\n", TRUE);
$mail = new html_mime_mail(array('X-Ma
$text = <<<END_TEXT
Hello.
This is a plain text email.
You want to send this email to {$HTTP_POST_VARS["receiver
The pictures you want are {$HTTP_POST_VARS["pic1"]} and {$HTTP_POST_VARS["pic2"]}.
Your comments are :
{$HTTP_POST_VARS["comments
Thank you.
END_TEXT;
$html = <<<END_HTML
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>{$HTTP_POST_VARS["recei
<div>The pictures you want are <b>{$HTTP_POST_VARS["pic1"
<div>These images are <img src="cid:{$HTTP_POST_VARS[
<div>Your comments are :<br><br><b>{$HTTP_POST_VA
<div>Thank you.</div>
END_HTML;
$mail->add_html($html, $text);
if(!$mail->build_message()
die('Failed to build email');
include('class.smtp.php');
$params = array(
'host' => 'smtp.softhome.net', // Mail server address
'port' => 25, // Mail server port
'helo' => 'mydomain.com', // Use your domain here.
'auth' => TRUE, // Whether to use authentication or not.
'user' => 'me@softhome.net', // Authentication username
'pass' => 'zzz1zzz' // Authentication password
);
$smtp =& smtp::connect($params);
$send_params = array(
'from' => 'joe@example.com', // The return path
'recipients' => 'zzzoobie@wmconnect.com', // Can be more than one address in this array.
'headers' => array(
'From: "Joe" <joe@example.com>',
'To: "Richard Heyes" <richard@[10.1.1.2]>', // A To: header is necessary, but does
'Subject: Test email' // not have to match the recipients list.
)
);
$mail->smtp_send($smtp, $send_params);
/*************************
** Debug stuff. Entirely unnecessary.
**************************
echo '<PRE>'.htmlentities($mail
?>
...which yielded:
Date: Fri, 26 Jul 02 02:57:39
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_985d26989b0481
--=_985d26989b0481dcd5303c
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding:
Hello.
This is a plain text email.
You want to send this email to you@doofus.com.
The pictures you want are alfred.gif and smiley.gif.
Your comments are :
ok...my test text
Thank you../
--=_985d26989b0481dcd5303c
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding:
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>you@doofus.com</b>.</di
<div>The pictures you want are <b>alfred.gif</b> and <b>smiley.gif</b>.</di=
v>
<div>These images are <img src=3D"cid:alfred.gif"> and <img src=3D"cid:smil=
ey.gif">.</div>
<div>Your comments are :<br><br><b>ok...my test text</b></div>
<div>Thank you.</div>
--=_985d26989b0481dcd5303c
It's echoing...but not really sending unles my email is down now.
What it's missing is the passing of the variable into these:
$background = $mail->get_file('backgroun
$mail->add_html_image($bac
Maybe we could change the $background bit above...but if I remember correctly, it doesn't want to get that file.
Try replacing ...
$mail->add_html($html, $text);
if(!$mail->build_message() )
die('Failed to build email');
with ...
$mail->add_html($html, $text);
$background = $mail->get_file('backgroun d.gif');
$mail->add_html_image($bac kground, 'background.gif', 'image/gif');
if(!$mail->build_message() )
die('Failed to build email');
And see what happens.
You will need to check your email too, so make sure you are putting proper email addresses in.
Richard.
$mail->add_html($html, $text);
if(!$mail->build_message()
die('Failed to build email');
with ...
$mail->add_html($html, $text);
$background = $mail->get_file('backgroun
$mail->add_html_image($bac
if(!$mail->build_message()
die('Failed to build email');
And see what happens.
You will need to check your email too, so make sure you are putting proper email addresses in.
Richard.
ASKER
Umm...no, I don't need to send any background. That was an example.
$picture1=$mail->get_file( '$HTTP_POS T_VARS["pi c1"]')
and
$mail->add_html_image($pic ture1,'$HT TP_POST_VA RS["pic1"] ', 'image/gif');
is what I need to have working properly...but I think it's throwing an error. Is the above right?
$picture1=$mail->get_file(
and
$mail->add_html_image($pic
is what I need to have working properly...but I think it's throwing an error. Is the above right?
The get-file method gets the contents of a file.
The add_html_images requires 3 parameters.
The first one is the data to be used.
The second one is the name to be looked for in the HTML data.
The third one is the type.
You are putting the $HTTP.... in a single quote which means this is the name.
if ...
$pot = 'fred' then
"$pot" == "fred", but '$pot' == '$pot'
So, try ...
$mail->add_html_image($pic ture1,$HTT P_POST_VAR S["pic1"], 'image/gif');
Richard.
The add_html_images requires 3 parameters.
The first one is the data to be used.
The second one is the name to be looked for in the HTML data.
The third one is the type.
You are putting the $HTTP.... in a single quote which means this is the name.
if ...
$pot = 'fred' then
"$pot" == "fred", but '$pot' == '$pot'
So, try ...
$mail->add_html_image($pic
Richard.
ASKER
Heyyyyy! I think we're really close now! It grabbed the file! Right now, I'm just using pic1 and it's still not sending...but look at the echo below.
I added:
$picture1 = $mail->get_file($HTTP_POST _VARS["pic 1"]);
$mail->add_html_image($pic ture1,$HTT P_POST_VAR S["pic1"], 'image/gif');
and got this echo:
Date: Sat, 27 Jul 02 03:38:08
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_2659e2a0143735 7d84019b2f 024cec0b"
--=_2659e2a01437357d84019b 2f024cec0b
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello.
This is a plain text email.
You want to send this email to zzzoobie@wmconnect.com.
The pictures you want are smiley.gif and alfred.gif.
Your comments are :
We are very very close now...
Thank you../
--=_2659e2a01437357d84019b 2f024cec0b
Content-Type: multipart/related;
boundary="=_8c3fd912b73b23 1320d9f0bc 679846eb"
--=_8c3fd912b73b231320d9f0 bc679846eb
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>zzzoobie@wmconnect.com< /b>.</div>
<div>The pictures you want are <b>cid:366c5db557cc69bd9f6 4b1080ca8b 1b5</b> =
and <b>alfred.gif</b>.</div>
<div>These images are <img src=3D"cid:cid:366c5db557c c69bd9f64b 1080ca8b1b 5"=
> and <img src=3D"cid:alfred.gif">.</ div>
<div>Your comments are :<br><br><b>We are very very close now...</b></div>
<div>Thank you.</div>
--=_8c3fd912b73b231320d9f0 bc679846eb
Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="smiley.gif"
Content-ID: <366c5db557cc69bd9f64b1080 ca8b1b5>
R0lGODlhQABaAPEAAPz+/Pz+BA QCBAAAACH/ C05FVFNDQV BFMi4wAwEA AAAh+QQJZA AAACwAAAAA
QABaAAEC/4SPqcvtD6OctNqLs9 68+w+G4kiW 5omm6sq27g vH8kzX9o3n +s73/g8MCn mCovFYrBkD
zKaTaXwtn1RqNFWsardJk2AL5p Ky4bJVEPqa 19aPmg1voj nvuH2eqdvv +b1fjqH3B4 dHIThIWHGI
mDixyLhW+PAIGSlBWVkmyYAJNR X5Cbap0InU 6XmkOalpWt qq2uBqyjob Nnogi0Sra+ uQm2r72ssJ
CrxLBkvKZmzGPKycWXl7Gt1MXM 04jZ19vf2n 7f3dHc63QE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0KWm 9vYmllDQpH ZW5lcmFsIE tpbmV0aWNz DQoNCkNyZW F0ZWQgYnkg
QWxjaGVteSBNaW5kd29ya3MnDQ pHSUYgQ29u c3RydWN0aW 9uIFNldCBQ cm9mZXNzaW 9uYWwNCmh0
dHA6Ly93d3cubWluZHdvcmtzaG 9wLmNvbQAh /upVTlJFR0 lTVEVSRUQg U0hBUkVXQV JFDQoNCkFz
c2VtYmxlZCB3aXRoIEdJRiBDb2 5zdHJ1Y3Rp b24gU2V0Og 0KDQpBbGNo ZW15IE1pbm R3b3JrcyBJ
bmMuDQpCb3ggNTAwDQpCZWV0b2 4sIE9ODQpM MEcgMUEwDQ pDQU5BREEu DQoNCmh0dH A6Ly93d3cu
bWluZHdvcmtzaG9wLmNvbQ0KDQ pUaGlzIGNv bW1lbnQgd2 lsbCBub3Qg YXBwZWFyIG luIGZpbGVz
IGNyZWF0ZWQgd2l0aCBhIHJlZ2 lzdGVyZWQg dmVyc2lvbi 4AOw0K
--=_8c3fd912b73b231320d9f0 bc679846eb --
--=_2659e2a01437357d84019b 2f024cec0b --
Looks like 2 cid's in there...I think they're supposed to within <img> tags...
Close...Want to finish it?
I added:
$picture1 = $mail->get_file($HTTP_POST
$mail->add_html_image($pic
and got this echo:
Date: Sat, 27 Jul 02 03:38:08
From: "Joe" <joe@example.com>
To: "Richard" <zzzoobie@wmconnect.com>
Subject: Example email using HTML Mime Mail class
MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/alternative;
boundary="=_2659e2a0143735
--=_2659e2a01437357d84019b
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding:
Hello.
This is a plain text email.
You want to send this email to zzzoobie@wmconnect.com.
The pictures you want are smiley.gif and alfred.gif.
Your comments are :
We are very very close now...
Thank you../
--=_2659e2a01437357d84019b
Content-Type: multipart/related;
boundary="=_8c3fd912b73b23
--=_8c3fd912b73b231320d9f0
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding:
<div>Hello.</div>
<div>This is a plain text email.</div>
<div>You want to send this email to <b>zzzoobie@wmconnect.com<
<div>The pictures you want are <b>cid:366c5db557cc69bd9f6
and <b>alfred.gif</b>.</div>
<div>These images are <img src=3D"cid:cid:366c5db557c
> and <img src=3D"cid:alfred.gif">.</
<div>Your comments are :<br><br><b>We are very very close now...</b></div>
<div>Thank you.</div>
--=_8c3fd912b73b231320d9f0
Content-Type: image/gif
Content-Transfer-Encoding:
Content-Disposition: inline; filename="smiley.gif"
Content-ID: <366c5db557cc69bd9f64b1080
R0lGODlhQABaAPEAAPz+/Pz+BA
QABaAAEC/4SPqcvtD6OctNqLs9
zKaTaXwtn1RqNFWsardJk2AL5p
mDixyLhW+PAIGSlBWVkmyYAJNR
CrxLBkvKZmzGPKycWXl7Gt1MXM
6v/PC58vLgAL/hMV4ZHBhc76Xd
ecElQi8y+8Gkg2xZlxahtFyZYX
rnp/baLYfabRjOoanZWwxqwrpf
tSwbMTRTiDOQ8+OrLrd9EPMou1
SZk5yRmJ6WgW+gmmM5VaimTaub
HUaaTbfN3Zf4DR5eWGd+jp5GLo
wrChOogHB05sEsPiRRMgzwjCCc
AwACADgAOgABAv+Ej6kg7d+WnH
R0wGjB+kMsmkOJ9QEJUatVyvWZ
dCCIxrFY1HioYSQGqWfH1shoyY
xQvsNtz7W0yMvHWsTCfc/PUMPS
b39/mk+/z++Vv3YAa8gb+O6alH
UlTKY8nRZQmYNObBLAAAIfkECQ
jOoanZWwxqwrpfJNCjQC4z65Y/
8+OrLrd9EPMou15e3rc3XxW19v
+gmmM5VaimTaubp6xlabs5V7l6
DR5eWGd+jp5GLovenn4Xt+s+bw
EsPiRRMgzwjCCcKgWpguO0TiIA
Av+Ej6kg7d+WnHS5gLPGrnp/ba
OJ9QEJUatVyvWZ5sOgQDtSwbMT
YSQGqWfH1shoyYaSo3lpSZk5yR
vHWsTCfc/PUMPSM9jShkHUaaTb
v3YAa8gb+O6alHII58CzwrChOo
NObBLAAAIfkECQoAAAAsAwAfA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 cid's in there...I think they're supposed to within <img> tags...
Close...Want to finish it?
You just just use
Content-type: text/html
with mail function and send <img src=http://yourserver.com/dir/filename.gif> tag...
Content-type: text/html
with mail function and send <img src=http://yourserver.com/dir/filename.gif> tag...
Well done.
Now add in the second pic ...
$picture2 = $mail->get_file($HTTP_POST _VARS["pic 2"]);
$mail->add_html_image($pic ture1,$HTT P_POST_VAR S["pic2"], 'image/jpg');
This will add in the second picture.
Can you check that all the server you are using for sendmail is valid. If not, you will need to use the smtp connector instead.
Gem100 - Nope! That does not do inline images. That would simply generate a page requiring the mailreader to download the images.
Now add in the second pic ...
$picture2 = $mail->get_file($HTTP_POST
$mail->add_html_image($pic
This will add in the second picture.
Can you check that all the server you are using for sendmail is valid. If not, you will need to use the smtp connector instead.
Gem100 - Nope! That does not do inline images. That would simply generate a page requiring the mailreader to download the images.
ASKER
Success!
I got it on the first try and someone showed me how to pass variables via the string_replace method, too.
It easy when you are familiar with the script.
Now for just a couple more questions.
This works:
'recipients' => "$receiver",
but right underneath it, this doesn't:
'To: "You" <$receiver>',
The <> tags are throwing the $receiver off and quotes don't work either.
Fix?
Also, how many points do you want for your help?
Thanks Richard
Best,
Z
I got it on the first try and someone showed me how to pass variables via the string_replace method, too.
It easy when you are familiar with the script.
Now for just a couple more questions.
This works:
'recipients' => "$receiver",
but right underneath it, this doesn't:
'To: "You" <$receiver>',
The <> tags are throwing the $receiver off and quotes don't work either.
Fix?
Also, how many points do you want for your help?
Thanks Richard
Best,
Z
You are mixing single and double quotes again.
Using quotes means treat everything inside them as plain text.
e.g.
echo "$name";
will show the contents of the variable $name.
echo '$name';
will show the $name on the screen, not the contents of $name, but the actually letters $, n, a, m and e.
Try ...
"To: \"You\" <$receiver>";
or
'To: "You" <' . $receiver . '>';
As for how many points, I will leave that up to you.
Richard.
Using quotes means treat everything inside them as plain text.
e.g.
echo "$name";
will show the contents of the variable $name.
echo '$name';
will show the $name on the screen, not the contents of $name, but the actually letters $, n, a, m and e.
Try ...
"To: \"You\" <$receiver>";
or
'To: "You" <' . $receiver . '>';
As for how many points, I will leave that up to you.
Richard.
ASKER
Yep...'To: "You" <'.$receiver.'>',
I was wondering about the include(blah.blah.blah.php );
Some hosts have the include disabled. Is there a way around that?
Ok...now the points...How do I award them if you've just commented? Don't you have to answer before awarded?
How many points would be fair?
I was wondering about the include(blah.blah.blah.php
Some hosts have the include disabled. Is there a way around that?
Ok...now the points...How do I award them if you've just commented? Don't you have to answer before awarded?
How many points would be fair?
If they have disbaled include, you will need to cut and paste the code. Watch out for the included file also including include/require!
You should be able to accept as answer any of my comments.
If you think more points should be awarded, you can amend the number of points before accepting any of my comments as an answer or you can create a new question called "Points for RQuadling" and I will place a comment in there which you then accept as an answer.
Regards,
Richard.
You should be able to accept as answer any of my comments.
If you think more points should be awarded, you can amend the number of points before accepting any of my comments as an answer or you can create a new question called "Points for RQuadling" and I will place a comment in there which you then accept as an answer.
Regards,
Richard.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well, seeing as you answered my q's with professionalism, patience, and humour even though I'm new at this stuff, I think you deserve 400 points. Thanks again.
Best,
Z
Best,
Z
Thank you.
I hope this all works for you OK. And good luck!
I hope this all works for you OK. And good luck!
ASKER
Know anything about sessions? I'm using php v4.2.2 now and although your code above works fine in it, I can't seem to get the sessions to work now. They worked before...
check if session support is enabled. Actually, make a small php script with
<?php
echo phpinfo();
?>
and see what you have there on "session"
<?php
echo phpinfo();
?>
and see what you have there on "session"
ASKER
I checked and it says: Session Support enabled
All those versions of php...Are they really necessary??? Jeez...
All those versions of php...Are they really necessary??? Jeez...
check the chapter on sessions then on PHP.net
Yes, they are necessary, 4.2.2 was a security patch of 4.2.1 for instance. You don't want to live with security hole, right?
Yes, they are necessary, 4.2.2 was a security patch of 4.2.1 for instance. You don't want to live with security hole, right?
<form name=myform method=post action=send.php>
Note the > at the end of the line.