PHP Mail function helyett PHPMailer
2012-09-23T09:19:44+02:00
2012-09-23T09:57:11+02:00
2022-07-19T08:51:12+02:00
serverman
Sziasztok,

IIS 7.5 alatt a sima PHP Mail funkciót szeretném a PHPMailer-re cserélni. Mivel a PHP Mail function az nem mükszik IIS 7.5 alatt, de azért is lenne szükségem itt a PHPMailer-re mert a 465-ös porton kellene kimenni a levélnek.


<?php // send an email if enabled using PHP's mail() if ($config['approval_email']) { // get this websites url to use as a link $url = 'http://'.dirname($_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"]); $subject = 'New comment pending approval - Multiatom Comment'; $headers = 'From: domain@domain.com'. "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $message = '<html> <body> '.$input['name'].' has made a new comment on your website and is pending your approval.<br><br> Their comment:<br> <p style="text-indent: 4px;">'.$input['body'].'</p><br> Choose it's fate: <a href="'.$url.'/admin/index.php?comment='.$input['id'].'&hash='.$hash.'&pend=Y">Approve</a> | <a href="'.$url.'/admin/index.php?comment='.$input['id'].'&hash='.$hash.'&pend=N">Deny</a> </body> </html>'; mail($config['admin_email'], $subject, $message, $headers); } // check if the request was sent via AJAX if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $insertedComment = new comments(); // call construct_html_comment function and return the just-inserted comment via JSON for jQuery to interpret echo json_encode(array('success'=>1, 'html'=>$insertedComment->construct_html_comment(array_map('stripslashes', $input), false), 'approval'=>$config['approval'])); } else { echo $config['approval'] ? 'Thanks for your comment! It'll be live as soon as it gets approval from up above.' : 'Thanks for the comment.'; } } else { // check if the request was sent via AJAX if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { // if there's an error, return them via JSON for jQuery to interpret echo '{"success":0,"errors":'.json_encode($input).'}'; } else { // if javascript happens to be disabled and the POST wasn't requested via AJAX, // iterate through the errors and display them to the user foreach ($input as $value) { echo $value.'<br />'; } } } } ?>

// send an email if enabled using PHP's mail()
if ($config['approval_email']) {

Itt kéne nekem valahogy beletenni a
$mail = new PHPMailer();
$mail->IsSMTP();

stb. dolgokat. Köszi.
Mutasd a teljes hozzászólást!
Lehet én tudom rosszul, de mintha a PHPMailer is a mail függvényt használná a küldésre.

Amúgy phpmailer működése:
Link
Mutasd a teljes hozzászólást!

abcd