Вот функция, попробуйте:
PHP:
скопировать код в буфер обмена
function sendMail( $to, $subject, $message, $mail_from = false ) { $mail_from = (!$mail_from) ? "noreply@".str_replace("www.", "", $_SERVER['SERVER_NAME']) : $mail_from; $headers = 'From: '.$mail_from."\n"; $headers.= 'Reply-to: '.$mail_from."\n"; $headers.= 'Return-Path: '.$mail_from."\n"; $headers.= 'Message-ID: <'.$uniqid.'@'.$_SERVER['SERVER_NAME'].">\n"; $headers.= 'MIME-Version: 1.0'."\n"; $headers.= 'Date: '.gmdate('D, d M Y H:i:s', time())."\n"; $headers.= 'X-Priority: 3'."\n"; $headers.= 'X-MSMail-Priority: Normal'."\n"; $headers.= 'X-Mailer: MyCMS : 1.0'."\n"; $headers.= 'X-MimeOLE: MyCMS : 1.0'."\n"; $headers.= 'Content-Type: multipart/mixed;boundary="----------'.$uniqid.'"'."\n\n"; $headers.= '------------'.$uniqid."\n"; $headers.= 'Content-Type: text/html;charset=utf-8'."\n"; $headers.= 'Content-Transfer-Encoding: 8bit'; return @mail( $to, $subject, $message, $headers ); }
(Отредактировано автором: 27 Апреля, 2016 - 18:51:34)
|