Zend
From Nephtali Documentation
Nephtali can easily be used side-by-side with the Zend Framework, which provides high-quality solutions to a broad range of coding needs. In the example below, The Zend Framework is used to process an SMTP-processed email. To use the Zend Framework, you just have to make sure you've added the directory of the framework to your site's include path.
include('Zend/Mail.php');
include('Zend/Mail/Transport/Smtp.php');
n\port\register(
$name = 'name',
$value = $_POST['name'],
$opts = array('max_length' => 50, 'filter' => n\constant\FILTER_TEXT)
);
n\port\register(
$name = 'email',
$value = $_POST['email'],
$opts = array('max_length' => 250, 'filter' => n\constant\FILTER_EMAIL)
);
n\port\register(
$name = 'message',
$value = $_POST['message'],
$opts = array('max_length' => 600, 'filter' => n\constant\FILTER_TEXT_MULTILINE)
);
n\pipe\register_action(
$name = 'mail',
$actions = array(
array(
'signature' => array('name','email','message'),
'function' => function($markup)
{
if (count($rows = n\port\validate(array('name', 'email', 'message'))))
{
return n\view\render($view = 'feedback', $markup, $rows);
}
$ports = n\port\get(array('name','email','message'));
$from = 'contact@nephtaliproject.com';
$to = 'feedback@nephtaliproject.com';
$subject = 'Nephtali contact form submission';
$message = "Name: ".$ports['name']."\n"
."Email: ".$ports['email']."\n"
."\n"
.$ports['message']."\n\n";
$config = array('auth' => 'login',
'username' => n\config\get('email_username'),
'password' =>n\config\get('email_password')
);
$tr = new Zend_Mail_Transport_Smtp('smtp.nephtali.com', $config);
Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail();
$mail->setBodyText($message);
$mail->setFrom($from);
$mail->addTo($to);
$mail->setSubject($subject);
$mail->send();
return n\view\render($view = 'default', $markup);
}
)
)
);

