Re: block.sendmail.php

From: Date: Thu, 30 Jan 2003 16:46:27 +0000
Subject: Re: block.sendmail.php
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7424@lists.php.net to get a copy of this message
>Is there an update for your Plugin "block.sendmail.php" available, >or is the 0.1 the right version? > >http://marc.theaimsgroup.com/?l=smarty-general&m=102323965311399&w=2 that is the only version, but it should - I haven't worked on it since, nor have I used it myself ... I got flamed for making it ;) and I have to say I agree with Monte and the others now - email sending functionality does not belong in a plugin, it should be kept in PHP instead, where the designer can't touch it. see this follow up on my post: http://marc.theaimsgroup.com/?l=smarty-general&m=102323987011529&w=2 A better solution is to use this alternative send_mail function in your PHP script: function send_mail($myname, $myemail, $contactname, $contactemail, $subject, $message) { $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; charset=iso-8859-1\n"; $headers .= "X-Priority: 1\n"; $headers .= "X-MSMail-Priority: High\n"; $headers .= "X-Mailer: php\n"; $headers .= "From: \"".$myname."\" <".$myemail.">\n"; return(mail("\"".$contactname."\" <".$contactemail.">", $subject, $message, $headers)); } And then keep your email message in a template by itself, separate from your HTML - render it and send it from your script like so: send_mail("me", "me@me.com", "you", "you@you.com", "Hey, You!", $smarty->fetch("my_email.tpl")); the rest of the list will probably agree with me when I say, this is the most appropriate way to do it? :) / Rasmus

« previous php.smarty.general (#7424) next »