Jump to content

bag

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling
  • Location
    UK

bag's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Guys, I want to send an inline image with an EMail. basically a logo at the top in a text email. I've recieved a few so I know it can be done but when I do it I get the filename printed underneath and the picture is clickable. This doesn't happen with the others. Any ideas? Here is my code whech send the Eail OK. $mail_logo = 'Picture.jpg'; $to = 'me@mydomain.com'; $subject = 'EMail with header'; $file = fopen($mail_logo,'rb'); $data = fread($file,filesize($mail_logo)); fclose($file); $data = chunk_split(base64_encode($data)); $headers = "From: sender@mydomain.com\r\nReply-To: sender@mydomain\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $boundary = md5(uniqid(time())); $headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n"; $message = "--$boundary\r\n"; $message .= "Content-Type: image/jpg;\n name=\"{$mail_logo}\"\n"; $message .= "Content-Disposition: related;\n filename=\"{$mail_logo}\"\n"; $message .= "Content-Transfer-Encoding: base64\n\n"; $message .= "$data\n\n"; $message .= "--$boundary\r\n"; $message .= "Content-Type: text/plain; charset=ISO-8859-1\n"; $message .= "\n\nThis is the plain text line\nand line 2"; $mail_sent = @mail( $to, $subject, $message, $headers );
  2. Try $to = 'name@whatever.com'; $subject = 'EMail from Contact form'; $message="Hi there\r\n"; $headers = "From: Fromname@something.com\r\nReply-To: Replyadd@something.com\r\n"; $mail_sent = @mail( $to, $subject, $message, $headers );
  3. here is how I upload a form. Contact_Form.html <form method="POST" action="Send_Contact_Form.php" enctype="multipart/form-data"> <input type="text" name="email" size="40" value=""> Please enter your EMail address.<br><br> <TEXTAREA NAME="message" COLS=80 ROWS=10 WRAP=SOFT></TEXTAREA><br><br> <input type="file" name="file" size="40" value=""> Any file you want to attach.<br><br> <input type="submit" value="Send Message" name="submit"> </form> Then Send_Contact_Form.php if ( $file_name != '' ) { $result = @copy ( $file, "$tmp_dir$file_name" ); where tmp_dir is defined by me to be the directory I want it to go to. Don't let it default if you can avoid it. $file is supplied and $filename is created for it by PHP. Note the enctype in the form. It won't work without it
  4. You say that is part of the script. I would guess you have a <head><body>etc. above the headers. Writing output before headers is a NoNo and the headers won't work. You should use $output = <MTML><HEAD>........ headers headers mail echo $output Although if it worked previously it must have had something similar in. Did you completely rewrite it?
  5. Thanks for the quick responses. We are on 5.1 here but I'll look at the parse_url function. That looks like something I could deal with instead of those patterns.
  6. I'm stumpted here as I get some strange errors and returns. I'm looking at a PHP page that reads the selected DB and generates text in the same way that phpMyAdmin does a DB dump with reading the tables, the setting etc. The phpMyAdmin is impossible for someone like me to read and all the PHP.net procedures don't have examples. Thats where I learn from. Can anyone give me some pointers to examples of PHP scripts for reading a DB format that I can learn from?
  7. Users have the capability of entering URLs and I have used the following $pattern = "^(https?|ftp)\:\/\/([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*(\:[0-9]{2,5})?(\/([a-z0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?\$"; if ( preg_match($pattern, $url) == FALSE ) { It got a bit out of hand and I'm lost. This one fails to validate valid urls and url validation must be something that has been done to death.
  8. It was suggested I add a mysql_error() into my die statement which I didn\'t know you could do. I was calling it later when it had obviously been flushed. Anyway, it told me there was a password error which I played about with until it clicked. It was accessing the MySQL server from the other node \'isis\' not my client \'echo\' and I had different passwords on access for each. Changed the password in the connection statement to the one for \'isis\' and away it went. Simple but still a pain. Anyway sorted now.
  9. Hi, I have two NT 4 servers running on my home network, both have Apache installed, one \'asia\' has MySQL 3.23.49-max-nt-log, installed. I can connect from my main system \'echo\' to MySQL using a command window to connect via ODBC all set up several months ago via instructions in a book. All working OK (As I can see). I just lately discovered PHP and decided to add that to my Intranet to allow access to real data. To this end I updated all versions to the latest, Apache 2.0.43, and on the other server, \'isis\', I installed PHP 4.3.0. The Apache, PHP combination works OK. The problem is when I come to connect to the remote DB I get nothing. It fails every time with no error message at all. I connected using the nodename \'asia\' with no joy so I tried the IP address. $connection= mysql_connect(\"192.168.0.1\",\"sqlaccess\",\"password\"); It must connect and be rejected but I get no error nor a connection. If I try an invalid IP I get a long delay before a failure with no message again!!!. It must be something simply because it\'s driving me loopy. Any ideas on where to look would be appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.