你通过了$email
应该有附件的地方。看看wp_mail 参数。
您还没有定义$to
在你的情况下,我假设应该是$email
.
试试这个,
$name = $_POST[\'cuf_sender\'.$n];
$email = $_POST[\'cuf_email\'.$n];
$subject= $this->o[\'subpre\'].\' \'.$_POST[\'cuf_subject\'.$n];
$msg = $_POST[\'cuf_msg\'.$n];
$extra = \'\';
foreach ($_POST as $k => $f )
if ( strpos( $k, \'cuf_field_\') !== false )
$extra .= $this->o[substr($k, 4, 7)].": $f\\r\\n";
$headers =
"MIME-Version: 1.0\\r\\n".
"Reply-To: \\"$name\\" <$email>\\r\\n".
"Content-Type: text/plain; charset=\\"".get_settings(\'blog_charset\')."\\"\\r\\n";
if ( !empty($from) )
$headers .= "From: ".get_bloginfo(\'name\')." - $name <$from>\\r\\n";
else if ( !empty($email) )
$headers .= "From: ".get_bloginfo(\'name\')." - $name <$email>\\r\\n";
$fullmsg =
"Name: $name\\r\\n".
"Email: $email\\r\\n".
$extra."\\r\\n".
\'Subject: \'.$_POST[\'cuf_subject\'.$n]."\\r\\n\\r\\n".
wordwrap($msg, 76, "\\r\\n")."\\r\\n\\r\\n".
\'Referer: \'.$_SERVER[\'HTTP_REFERER\']."\\r\\n".
\'Browser: \'.$_SERVER[\'HTTP_USER_AGENT\']."\\r\\n";
if ( wp_mail( $email, $subject, $fullmsg, $headers) )
{
echo $to;
exit();