以下代码应在表单提交时发送电子邮件:
wp_mail
对应该纠正的内容有何帮助?
我甚至尝试使用以下代码对我的SMTP服务器验证add_action('phpmailer_init', 'send_smtp_email');
function send_smtp_email($phpmailer) {
$phpmailer->isSMTP();
$phpmailer->Host = 'example.com';
$phpmailer->SMTPAuth = true;
$phpmailer->Port = '465';
$phpmailer->Username = 'me@example.com';
$phpmailer->Password = 'password';
$phpmailer->SMTPSecure = 'ssl';
$phpmailer->From = 'me@example.com';
$phpmailer->FromName = 'Me';
}
:
来源(https://gist.github.com/butlerblog/c5c5eae5ace5bdaefb5d)
// Delete all files in given directory
let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String
let dataPath = NSURL(fileURLWithPath: path)
if let enumerator = FileManager.default.enumerator(atPath: dataPath.path!) {
while let fileName = enumerator.nextObject() as? String {
do {
try FileManager.default.removeItem(atPath: "\(dataPath)\(fileName)")
}
catch let e as NSError {
print(e)
}
catch {
print("error")
}
}
}
答案 0 :(得分:0)
send()
才能实际发送任何内容。添加此项(包括基本错误处理):
if (!$phpmailer->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $phpmailer->ErrorInfo;
}