Jump to content

Rayj2019

New Members
  • Posts

    6
  • Joined

  • Last visited

Rayj2019's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you, thank you, thank you! You fixed it. Attachment being sent and received. And yes, I will use PHPmailer for my next project, if needed. Ray
  2. So, I use mail() to send form data to a client. Works great. Now I am trying to send email to the same client, but with an attachment. I know PHPmailer is preferred, but I'm old school and would like to get this to work. The file I want to send as attachment gets to the far end, but Outlook email displays the binary data instead of having the pdf as an attachment attachment and looks like this: Attached is the Legal Description for 24050240--8f082344de8525de682e9d6aa86aa83f Content-Type: application/pdf; name="Testfile1.pdf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Testfile1.pdf" JVBERi0xLjcNJcjIyMjIyMgNMSAwIG9iago8PC9OYW1lcyA4IDAgUi9PdXRsaW5lcyAyIDAgUi9U eXBlL0NhdGFsb2cvUGFnZXMgMyAwIFIvVmVyc2lvbi8xLjc+Pg0KZW5kb2JqCjIgMCBvYmoKPDwv VHlwZS9PdXRsaW5lcy9Db3VudCAwPj4NCmVuZG9iagozIDAgb2JqCjw8L0NvdW50IDEyL0tpZHNb OSAwIFIgNTAgMCBSIDc1IDAgUiA5OSAwIFIgMTI5IDAgUiAxNDUgMCBSIDE2OCAwIFJdL1R5cGUv UGFnZXM+Pg0KZW5kb2JqCjQgMCBvYmoKPDwvU3ViamVjdCgpL1Byb2R1Y2VyKEFzcG9zZS5QZGYg Zm9yIC5ORVQgOS4yLjEpL0NyZWF0aW9uRGF0ZShEOjIwMjQwMTI2MTE1NTQzKS9BdXRob3IoKS9N b2REYXRlKEQ6MjAyNDAxMjYxMTU1NDMpL0NyZWF0b3IoQXNwb3NlIEx0ZC4pL1RpdGxlKE11bHRp cGxlIERvY3VtZW50cyk+Pg0KZW5kb2JqCjggMCBvYmoKPDwvRGVzdHMgMTg0IDAgUj4+DQplbmRv ... ... more of this... The file size is 723709. Here is the code I am using: (I have some echo statements to help me trouble shoot.) Your help appreciated. function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) { echo nl2br ("In funtion mail_attachment: filename = $filename\n"); $file = ($filename); echo nl2br ("In funtion mail_attachment: file = $filename\n"); echo nl2br ("In funtion mail_attachment: path = $path\n"); $file_size = filesize("$path/$file"); echo ("file_size = $file_size\n"); $handle = fopen($path.$filename, "rb"); echo ("handle = $handle"); //$content = file_get_contents($file); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); echo ("Content = $content\n"); $uid = md5(uniqid(time())); $eol = PHP_EOL; // Headers $header = "From: ".$from_name." <".$from_mail.">".$eol; $header .= "Reply-To: ".$replyto.$eol; $header .= "MIME-Version: 1.0".$eol; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\""; // // Message $header .= "--".$uid.$eol; $header .= "Content-type:text/plain; charset=iso-8859-1.".$eol; $header .= "Content-Transfer-Encoding: 8bit".$eol.$eol; //$message .= $body.$eol; $message .= "--".$uid.$eol; $message .= "Content-Type: application/pdf; name=\"".$filename."\"".$eol; // use different content types here $message .= "Content-Transfer-Encoding: base64".$eol; $message .= "Content-Disposition: attachment; filename=\"".$filename."\"".$eol; $message .= $content.$eol; $message .= "--".$uid."--"; if (mail($mailto, $subject, $message, $header)) { echo "mail send ... OK"; // or use booleans here } else { echo "mail send ... ERROR!\n"; echo nl2br ("file = $file\n"); echo nl2br ("path.filename = $path.$filename\n"); } }
  3. Yea, been coding since the 80's...mostly machine code. But created a lot of javascript both client and server, more recently. I understand the security issues. I'm not an idiot. Thanks.
  4. Sorry if this is not the correct thread for this. I am not a web developer, per-se. However I know enough to be dangerous! 😯 However I am creating website for a small business. I'm at the point that I need to incorporate login/authentication. I don't need it on the index page, but I do need it on one other page. I'm not having luck finding a script online. Can anyone point me to either a freeware or not real expensive login script with the following capabilities: -sign up/register -verify registration via email -Login applies to one page (not index.html). I have a page with a php form that needs password protection -Secure password creation/storage (MySQL) -remember password -change password Thanks and appreciate comments. Ray
×
×
  • 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.