我有 2 页:
自动化.php checkemail.php
在automate.php上是:
<?php include 'scripts/checkemail.php'; ?>
和:
<?php
if(!function_exists("sendemail"))
{
function sendemail($email_to,$email_from,$email_subject,$email_body,$email_replyto,$cc='')
{
if(filter_var($email_to, FILTER_VALIDATE_EMAIL))
{
require_once "/usr/local/lib/php/Mail.php";
$from = $email_from;
$to = $email_to;
$subject = $email_subject;
$body = $email_body;
$host = "mail.domain.co.uk";
$username = "sending@domain.co.uk";
$password = "*********";
$headers = array ('From' => $from,
'To' => $to,
'Cc' => $cc,
'Subject' => $subject,
'Content-type' => 'text/html');
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$rec = $to.', '.$cc;
$mail = $smtp->send($rec, $headers, $body);
}
}
}
?>
然后在checkemail.php我调用这个函数:
sendemail("techsupport@domain.co.uk","Support <no-reply@domain.co.uk>","Contact Not Found",$contact_not_found_email,"no-reply@domain.co.uk");
但我收到此错误:
Fatal error: Call to undefined function sendemail() in /home/integra/public_html/automate/scripts/checkemail.php on line 180