business seo
Aktuality CSSHtmlJavascriptPhpRegex
Odosielanie e-mailu s prílohou - Php
php, e-mail, prílohaProstredníctvom uvedeného zdrojového kódu je možné odosielať e-maily s priloženým súborom. Adresa požadovaného súboru je zapísaná v premennej $file a zvolený názov, pod akým bude súbor adresátovi zaslaný je zapísaný v premennej $filenewname.




Zdrojový kód:
$recipient = "recipientemailaddress@example.com" ;
$sender = "senderemailaddress@example.com" ;
$title = "Message title." ;
$message = "Message content." ;
$header = "From: Sender name <" . $sender . ">" ;

$random = md5(time());
$boundary = "==Multipart_Boundary_x{$random}x";
$header .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$boundary}\"";

$message = "This is a multi-part message in MIME format.\n\n" . "--{$boundary}\n" . "Content-Type: text/html; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
$message .= "--{$boundary}\n";

$file = "file_name.php";
$filenewname = "file_new_name.php";
$filecreate = fopen($file,"rb");
$filecontent = fread($filecreate,filesize($file));
fclose($filecreate);
$filecontent = chunk_split(base64_encode($filecontent));
$message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"" . $filenewname . "\"\n" . "Content-Disposition: attachment;\n" . " filename=\"" . $filenewname . "\"\n" . "Content-Transfer-Encoding: base64\n\n" . $filecontent . "\n\n";
$message .= "--{$boundary}\n";

$sendmessage = @mail($recipient, $title, $message, $header);
Najčítanejšie články
Konvertovanie obsahu z Windows-1250 a ISO-8859-2 do UTF-8
Zmena farby odkazu počas kliknutia - CSS
Nastavenie cookies prostredníctvom Javascript
Odosielanie e-mailu s prílohou - Php
Overenie formátu www adresy - RegEx
2023 Webplus|

Odosielanie e-mailu s prílohou - Php

|Podmienky používania|Kontakt