[PHP] mail question (mime)

2003-12-16 Thread Bill Green
Greetings all.

In an effort to understand more about mime mail with php, I'm writing a
little function to send a multipart/alternative encoded mime mail from a
browser interface. I know you guys have answered these types of questions
many times, but I've googled and research til I'm blue. I'm still somewhat
new to php so I apologize. I'm on a shared hosting environment running
Apache 1.3.29 (Unix), magic_quotes_gpc = on, path to sendmail =
/usr/sbin/sendmail -t -i, smtp is localhost on port 25 (and I don't know
much about Unix permissions). My client platform is Mac, my email client is
Outlook Express (might as well be testing to the lowest common denominator).
I've found lots of php classes on mime mail but have not tried them because
I want to understand the code.

I can use this code to send plain text email or html email just fine, but
not multipart/alternative or mixed. Here's the relevant code. Can someone
point out the error of my ways?

browser interface: 5 fields (3 input of type=text, 2 input of type=textarea)
names:
$from
$to
$subject
$text_msg
$html_msg

On submit, I trim all and stripslashes on the textarea inputs (interesting
that magic quotes seems to add slashes to textarea inputs automatically),
then set my email headers:

$headers ="From: {$from}\n";
$headers .="Reply-To: {$from}\n";
$headers .="Return-Path: {$from}\n";
$headers .="Subject: {$subject}\n";
$headers .="X-Sender: {$from}\n";
$headers .="X-Mailer: PHP\n";
$headers .="X-MSMail-Priority: High\n";
$headers .="MIME-Version: 1.0\n";
$headers .="Content-Type: multipart/alternative;
boundary=\"--i0o9u8h7g65v\"";
$message ="--i0o9u8h7g65v\n";
$message .="Content-Type: text/plain; charset=iso-8859-1\n";
$message .="Content-Transfer-Encoding: 7bit\n";
$message .="Content-Disposition: inline\n";
$message .=$text_msg."\n";//plain text message here
$message .="--i0o9u8h7g65v\n";
$message .="Content-Type: text/html; charset=iso-8859-1\n";
$message .="Content-Transfer-Encoding: 7bit\n";
$message .="Content-Disposition: inline\n";
$message .=$html_msg."\n";//html message here
$message .="--i0o9u8h7g65v";

mail($to,$subject,$message,$headers);

The email is sent successfully, but with no message in the message body.
Looking at the message source I see that all of the headers are set and I
see the boundaries and I see both versions of the messages as one would
expect. It all looks correct, even as compared to other mime encoded email I
receive and read just fine. I've tried many variations on these variables.
FYI, if I change the $header = "Content-Type: multipart/alternative; ";
to $message = "Content-Type: ..."; then I see the raw code in the message
body, but of course that does no good. Same results when message is viewed
in a browser based hotmail or yahoo account.

I simply do not understand what I don't understand, so I don't know how to
ask my question. Is this a coding problem, sendmail, permissions, a server
issue???

Thanks for your help.


-- 
Bill
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail question (mime)

2003-12-16 Thread Bill Green
Greetings all. (hope this isn't a second post, first try seemed to fail)

In an effort to understand more about mime mail, I'm writing a
little function to send a multipart/alternative encoded mime mail from a
browser interface. I know you guys have answered these types of questions
many times, but I've googled and research til I'm blue. I'm still somewhat
new to php so I apologize. I'm on a shared hosting environment running
Apache 1.3.29 (Unix), magic_quotes_gpc = on, path to sendmail =
/usr/sbin/sendmail -t -i, smtp is localhost on port 25 (and I don't know
much about Unix permissions). My client platform is Mac, my email client is
Outlook Express (might as well be testing to the lowest common denominator).
I've found lots of php classes on mime mail but have not tried them because
I want to understand the code.

I can use this code to send plain text email or html email just fine, but
not multipart/alternative or mixed. Here's the relevant code. Can someone
point out the error of my ways?

browser interface: 5 fields (3 input of type=text, 2 input of type=textarea)
names:
$from
$to
$subject
$text_msg
$html_msg

On submit, I trim all and stripslashes on the textarea inputs (interesting
that magic quotes seems to add slashes to textarea inputs automatically),
then set my email headers:

$headers ="From: {$from}\n";
$headers .="Reply-To: {$from}\n";
$headers .="Return-Path: {$from}\n";
$headers .="Subject: {$subject}\n";
$headers .="X-Sender: {$from}\n";
$headers .="X-Mailer: PHP\n";
$headers .="X-MSMail-Priority: High\n";
$headers .="MIME-Version: 1.0\n";
$headers .="Content-Type: multipart/alternative;
boundary=\"--i0o9u8h7g65v\"";
$message ="--i0o9u8h7g65v\n";
$message .="Content-Type: text/plain; charset=iso-8859-1\n";
$message .="Content-Transfer-Encoding: 7bit\n";
$message .="Content-Disposition: inline\n";
$message .=$text_msg."\n";//plain text message here
$message .="--i0o9u8h7g65v\n";
$message .="Content-Type: text/html; charset=iso-8859-1\n";
$message .="Content-Transfer-Encoding: 7bit\n";
$message .="Content-Disposition: inline\n";
$message .=$html_msg."\n";//html message here
$message .="--i0o9u8h7g65v";

mail($to,$subject,$message,$headers);

The email is sent successfully, but with no message in the message body.
Looking at the message source I see that all of the headers are set and I
see the boundaries and I see both versions of the messages as one would
expect. It all looks correct, even as compared to other mime encoded email I
receive and read just fine. I've tried many variations on these variables.
FYI, if I change the $header = "Content-Type: multipart/alternative; ";
to $message = "Content-Type: ..."; then I see the raw code in the message
body, but of course that does no good. Same results when message is viewed
in a browser based hotmail or yahoo account.

I simply do not understand what I don't understand, so I don't know how to
ask my question. Is this a coding problem, sendmail, permissions, a server
issue???

Thanks for your help.


-- 
Bill
--

-- 
Bill
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mail question (mime)

2003-12-17 Thread Bill Green
Thanks for your replies. Figured it out, just blind. The $headers were
written correctly (except for \r\n at end of lines though \n seems to work
in this case). The problem was in the call to the boundary, the boundary has
to start with -- outside the quoted string definition of the boundary, and
end same with -- at the end of the message.

-- 
Bill
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] drop down list of years puzzles me

2004-01-20 Thread Bill Green
This works to create a drop down select box of numbers 1-12:

for($i=1; $i < 13; $i++) {
echo "".$i."\n";
}

This doesn't to create a drop down box of years:

$curr_year = intval(date('Y'));
$range = 10;
for ($y=$curr_year; $y < $range; $y++) {
 echo "".$y."\n";
}

When I check for errors:
$curr_year = 2004
$curr_year is an integer
$range = 10
$curr_year + $range = 2014
$y = 2004

But my select box is empty... as in:



What is it that I don't understand?

-- 
Bill
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mysql went away

2004-05-12 Thread Bill Green
HI. I've been using mySQL 4.0.13, php4.3.4, and phpMyAdmin2.5.5 on Mac 
OS 10.3.3 as a learning/testing/development environment for a couple of 
months now - no problems, works great.

I've created more than a few mySQL databases and tables, but yesterday 
I created a database, a table, and LOAD DATA from within phpMyAdmin. 
Successfully. I looked at the data and all was fine. Logged out and 
went away for a while. Came back and phpMyAdmin would not show me my 
databases in the left frame, and I could not launch a query window. I 
could see runtime information, system vars, processes, and even 
privileges.

I tried logging in to mySQL through the terminal Through the command 
line client I can run simple commands, but no commands to view or 
affect databases or tables.

I can run php scripts from a browser - connect to databases, retrieve 
and even insert/update data, but I cannot view databases or tables, and 
though I haven't tried I doubt I'll be able to create, delete, or 
backup databases or tables.

Does anyone have a clue about what the problems may be or where I 
should start?

---
Bill Green
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php