Jump to content

bag

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Everything posted by bag

  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 = '[email protected]'; $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: [email protected]\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 = '[email protected]'; $subject = 'EMail from Contact form'; $message="Hi there\r\n"; $headers = "From: [email protected]\r\nReply-To: [email protected]\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.
×
×
  • 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.