我用ubuntu和mailcatcher安装vagrant dev机器
sudo apt-get install ruby rubygems ruby-dev sqlite3 libsqlite3-dev
sudo gem install mailcatcher
我跑
mailcatcher --http-ip=0.0.0.0
在php.ini中我有sendmail_path = "/usr/bin/env /usr/local/bin/catchmail"
mailcather正在运行,但在php skript中我用
进行测试<?php
// The message
$message = "Line 1\r\nLine 2\r\nLine 3";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n");
// Send
$sent = mail('caffeinated@example.com', 'My Subject', $message);
?>
邮件在Mailcatcher中没有捕获
答案 0 :(得分:2)
$message = "Line 1\r\nLine 2\r\nLine 3";
$message = wordwrap($message, 70, "\r\n");
$sent = mail('caffeinated@example.com', 'My Subject', $message, null,'-fwebmaster@example.com');
答案 1 :(得分:2)
你很可能将smtp_port设置为端口25,你应该在php.ini中将其更改为1025,因此它将命中Mailcatcher而不是常规MTA。如果这样做,那么您不必指定额外的参数。