简体   繁体   English

当我尝试从服务器发送邮件时遇到致命错误?

[英]when i am trying to send mail from server getting fatal error?

this is my mail script trying to send mail from my server. 这是我的邮件脚本,试图从服务器发送邮件。

<?php
$subject = 'This is an HTML email.';
$smtp_server = 'smtp.mydomain.com';
$from = $smtp_username = 'info@mydomail.com';
$smtp_password = 'mypassword';
$html = 'This is an <strong>HTML</strong> <i>formatted</i> email!';
$text = strip_tags($html);
$to = 'ramsai.php@gmail.com';
//$cc = array('foo@example.com');
//$bcc  array('bar@example.com', 'baz@example.com');

// send the message
$result = sendMail($subject, $smtp_server, $smtp_username, $smtp_password, $html, $text, $to);

// check to see if the message was sent properly
if ($result !== true) {
    echo 'There was an error sending the message. ('.$result.')';
} // end if the message was not sent properly
else {
    echo 'Message sent successfully.';
} // end else the message was sent properly


?>

When i am trying to run this script in my godaddy server i am getting fatal error: Fatal error: Call to undefined function sendMail() in /home/content/99/7916299/html/EMRXXX/EMRnew/Patient/sendmail1.php on line 13 当我尝试在Godaddy服务器中运行此脚本时,出现致命错误:致命错误:调用/home/content/99/7916299/html/EMRXXX/EMRnew/Patient/sendmail1.php中的未定义函数sendMail() 13行

Thank you in advance, Ramsai 预先谢谢拉姆赛

Fatal error: Call to undefined function sendMail() 致命错误:调用未定义的函数sendMail()

Means you forgot to include your sendMail() user function. 意味着您忘记了包括sendMail()用户功能。 Because there is no native php sendMail() function... 因为没有本机php sendMail()函数...

You should use the native mail() function and setup your server to use sendmail (smtp) within your php.ini file: 您应该使用本机mail()函数并将服务器设置为在php.ini文件中使用sendmail(smtp):

mail($to,$subject,$content,$headers);

No 1. you can use native function of PHP called mail(). 否1.您可以使用PHP的本机函数mail()。 for more details http://www.w3schools.com/php/php_mail.asp 有关更多详细信息,请访问http://www.w3schools.com/php/php_mail.asp

here you have to setup SMPT details in your php.ini file or u can overwrite itfrom your code. 在这里,您必须在php.ini文件中设置SMPT详细信息,或者您可以从代码中覆盖它。

No 2. Use PHPMailer Library.Very much easy to integrate. 否2.使用PHPMailer Library。非常易于集成。 you can get it from http://code.google.com/a/apache-extras.org/p/phpmailer/ 您可以从http://code.google.com/a/apache-extras.org/p/phpmailer/获取

Have you included some php library which supports sendmail? 您是否包含一些支持sendmail的php库?

If you're trying to use the OS command sendmail, this won't work like that. 如果您尝试使用OS命令sendmail,则将无法正常工作。

PHPs mail function isn't recommended so use something like PHPMailer . 不建议使用PHP的邮件功能,因此请使用PHPMailer之类的东西。

You need to find the php file in which defination of method sendMail is written and then include it . 您需要找到写有sendMail方法定义的php文件,然后将其包括在内。 If by chance its in same directory then simply add this line on top 如果偶然在同一目录中,则只需在顶部添加此行

require_once 'sendmail.php' ;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试转到页面时出现致命错误 - I am getting a Fatal error when trying to go to a page 当我尝试使用 phpmailer 发送邮件时,出现错误 - When i tried to send mail using phpmailer, i am getting error 为什么会出现致命错误:不在对象上下文中时使用$ this? - Why am I getting the Fatal error: Using $this when not in object context? Zend Framework:尝试使用Zend Mail Transport发送带附件的多封电子邮件时出现致命错误 - Zend Framework: Fatal error when trying to use Zend Mail Transport to send multiple emails with attachments 我无法在 cloudfront 中获得签名的 url,出现致命错误,我正在尝试的代码如下 - I am not able to get signed url in cloudfront, getting fatal error, code I am trying is below 我无法使用PHP邮件功能发送邮件...我收到错误消息 - I can't send mail using PHP mail function… I am getting an error 为什么我在尝试使用phpmailer发送电子邮件激活新用户帐户时收到此错误 - Why am i getting this error when trying to send email for activation of new user account with phpmailer 尝试在php中发送邮件时出现错误 - Getting error while trying to send mail in php 我发送附件邮件时出错警告:filesize() - Getting error when i am sending attachment mail Warning: filesize() 我在尝试发送电子邮件验证时遇到错误 - I am getting error while trying to send email verification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM