if (isset($_POST['chk_smtp']) && $_POST['chk_smtp'] == 'external') { if (!trim($_POST['smtp_host']) | !trim($_POST['smtp_port']) | !trim($_POST['smtp_username']) | !trim($_POST['smtp_password'])) { print "Please complete SMTP info"; exit; } $intPattern = "/([0-9]{2,4})\$/"; if (!preg_match($intPattern, trim($_POST['smtp_port']), $matches)) { print "Invalid SMTP Port"; exit; } $smtpMailer->setSmtpHost(trim($_POST['smtp_host'])); $smtpMailer->setSmtpUsername(trim($_POST['smtp_username'])); $smtpMailer->setSmtpPassword(trim($_POST['smtp_password'])); $smtpMailer->setSmtpPort($_POST['smtp_port']); if (isset($_POST['chk_smtp_secure'])) { $smtpMailer->setIsSecure(true); } else { $smtpMailer->setIsSecure(false); } $smtpMailer->setMailType($_POST['contenttype']); $smtpMailer->setMailFrom($realname); $smtpMailer->setMailFromEmail($from); $smtpMailer->setReplayMail($_POST['replyto']); try { $smtpMailer->createSMTP(); } catch (Zend_Exception $e) { print "<br/>" . $e->getMessage(); exit; } } //process the emails