我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何使用PHP发送电子邮件

<?php
$message = "Line 1
Line 2
Line 3";
$message = wordwrap($message, 70, "
");
$retval=mail('xxx@gmail.com', 'My Subject', $message);
 if( $retval == true )
     {
        echo "Message sent successfully...";
     }else {
            echo "Message could not be sent...";
           }
?>

It gives me message as Message could not be sent .

Yor problem is here: $message = wordwrap($message, 70, " "); you neet to add .=

It is the same as $message = $message . "wordwrap($message, 70, " ")";

近期文章

  • 在php中向wsdl发送XML请求
  • 在终端中安装xdebug
  • Brew + PHP 7 + XDebug没有显示
  • 简单的Mysqli更新查询无法正常工作[重复]
  • 从日期中选择(字符串格式)[关闭]
  • Laravel 5.2 - 多重关系
  • preg_replace n次匹配的字符串?
  • 在更改或文本框离开时在php中的ajax请求中发布文本框值
  • 用组选择2 ajax结果
  • 如何在超时后重置sql字段
  • 找不到nginx + php5-fpm.sock
  • 如何在HTML上将CSS应用于Excel导出
  • 从HTML页面中的所有HTML标记中搜索我的字符串
  • 如何让2个html页面进行通信
  • phpMailer没有添加多个地址
  • 检测Router :: connect中的子域
  • 如何强制PHP文档返回的八位字节流上的标题?
  • 撇号不能通过.po文件传出
  • 在表单提交时,浏览器加载具有处理表单代码的php文件
  • 在Wordpress中对自定义分类术语页面进行排序

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华