Skip to content

Instantly share code, notes, and snippets.

@manviny
Last active August 29, 2015 14:20
Show Gist options
  • Save manviny/706d290e58a33ffffbf3 to your computer and use it in GitHub Desktop.
Save manviny/706d290e58a33ffffbf3 to your computer and use it in GitHub Desktop.
Función para enviar email
<?php
$plantilla = "clientes";
$municipio = "Paterna";
foreach ( $pages->get("template=$plantilla")->children("cli_municipio=$municipio") as $hijo) {
sendEmail( 'correo@gmail.com', $hijo->email, 'cafelin', 'venga que empieza la clase');
echo $hijo->email;
}
?>
<?php
/**
* NEEDS wireMail SMTP module to be installed and configured properly
*/
function sendEmail($from, $to, $subject, $message){
$mail = wireMail();
$mail->to($to)->from($from); // all calls can be chained
$mail->subject($subject);
$mail->body($message);
$mail->bodyHTML($message);
$mail->send();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment