标签: phpmailer

使用PHPMailer发送纯文本电子邮件

我在使用PHPMailer发送纯文本电子邮件时遇到问题.

我有一个文本,我从文本文件中读取并通过PHPMailer将其邮寄给邮件收件人

当收件人获得实际的电子邮件时,邮件的格式与文本文件中的格式不同,所有内容都在一行中,我发送的电子邮件中不包含新行和标签.文字包装完全关闭.

码:

        $mail->ContentType = 'text/plain'; 
        $mail->IsHTML(false);
        $address = "test@test.com";
        $mail->AddAddress($address, "John Doe");

        $mail->SetFrom(EMAIL_TEST_FROM);

        $mail->AddReplyTo(EMAIL_TEST_REPLY);



        $mail->Subject = $action." REGISTRATION ".$formName.$tld;
        $mail->From = EMAIL_TEST;  

        $mail->MsgHTML(file_get_contents($newFile));


        if($mail->Send()){
            return true;
        }
Run Code Online (Sandbox Code Playgroud)

php email formatting plaintext phpmailer

18
推荐指数
2
解决办法
4万
查看次数

Phpmailer AddBcc无法正常工作

我使用phpmailer发送电子邮件,它的工作原理是收件人收到邮件,除了密件抄送和cc详细信息没有显示邮件.有人可以建议解决这个问题.代码是

require_once("PHPMailer_v5.1/class.phpmailer.php");
require_once("PHPMailer_v5.1/language/phpmailer.lang-en.php");              
$mailer = new PHPMailer();
$mailer->IsSMTP();              
$mailer->SMTPAuth = true;                   
$mailer->SMTPSecure = "tls";
$mailer->Host = 'smtp.gmail.com';
$mailer->Port = 587;                
$mailer->Username = "myuserid";
$mailer->Password = "mypassword";
$mailer->FromName = $fromname;
$mailer->From = "myuserid";             
$mailer->AddAddress("to@gmail.com",$toname);                
$mailer->Subject = $subject;                
$mailer->Body =$content;                
$mailer->AddCC("something@gmail.com", "bla");               
$mailer->AddBCC("foo@gmail.com", "test");
if(!$mailer->Send())
{
echo "Message was not sent";
}
else
echo "mail sent";
Run Code Online (Sandbox Code Playgroud)

php phpmailer

18
推荐指数
5
解决办法
9万
查看次数

使用PHPMailer在PHP中进行SMTP身份验证时出现问题,Pear Mail正常工作

我在使用PHPMailer类发送电子邮件时遇到问题,但它适用于PEAR Mail :: factory.

我想问题是SMTP身份验证,但我找不到问题.

有问题的代码是:

<?php
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();       // set mailer to use SMTP
$mail->Host = 'mail.xxx.com.br';  // my host here
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = 'xxx@xxx.com.br';  // a valid email here
$mail->Password = '***';  // the password from email
$mail->From = 'from@xxx.com.br';
$mail->SMTPDebug = true;
$mail->AddReplyTo('from@xxx.com.br', 'Test');

$mail->FromName = 'Test SMTP';
$mail->AddAddress('teste@xxx.com.br', 'teste@xxx.com.br');

$mail->Subject = 'Test SMTP';
$mail->IsHTML(true);
$mail->Body = '<b>Teste</b><br><h1>teste 2</h1>';   
//$mail->Send();

if(!$mail->Send())
{
   echo "Message could not …
Run Code Online (Sandbox Code Playgroud)

php email pear smtp phpmailer

17
推荐指数
3
解决办法
12万
查看次数

通过PHPMailer添加附件

我有以下PHPMailer代码.问题是,文件成功上传到服务器但附件未在邮件中发送.据我所知,附件代码似乎是正确的.请查看代码并告诉我哪里出错了.

形成

<form name="contactform" method="post" action="send1.php" enctype="multipart/form-data">
<table width="100%" border="0">
<tr>
 <td id="ta">
 <label for="title">Title *</label>
 </td>
 <td id="ta">
 <select name="title">
 <option value="0">Title</option>
 <option value="1">Mr.</option>
 <option value="2">Ms.</option>
 <option value="3">Mrs.</option>
 </select></td></tr><tr><td id="ta">
  <label for="first_name">First Name *</label>
 </td>
 <td id="ta">
  <input  type="text" name="first_name" maxlength="50" size="30" required="required">
 </td>
</tr>
<tr>
 <td id="ta">
  <label for="last_name">Last Name *</label>
 </td>
 <td  id="ta">
  <input  type="text" name="last_name" maxlength="50" size="30" required="required">
 </td>
</tr>
<tr>
 <td id="ta">
  <label for="email">Email Address *</label>
 </td>
 <td  id="ta">
  <input  type="text" name="email" maxlength="80" size="30" required="required"> …
Run Code Online (Sandbox Code Playgroud)

php email phpmailer

17
推荐指数
1
解决办法
5万
查看次数

在邮件正文中插入图像

用户点击发送按钮时如何在邮件正文中插入图像.我正在使用php邮件

html php phpmailer

15
推荐指数
2
解决办法
7万
查看次数

PHPMailer附件,没有物理文件

所以:

// Setup mail class, recipients and body
$mailer->AddAttachment('/home/mywebsite/public_html/file.zip', 'file.zip');
The AddAttachment function has four arguments:

AddAttachment(PATH_TO_FILE, FILENAME, ENCODING, HEADER_TYPE)
Run Code Online (Sandbox Code Playgroud)

我以前使用xmail(),当我在这里添加附件时,我传递了文件名和内容,应该在其中.

像这样:

$xmail->addAttachment('myamazingfile.pdf', $content);
Run Code Online (Sandbox Code Playgroud)

我怎么能以同样的方式工作,所以当我AddAttachment()从PHPmailer类调用时,我可以传递相同或类似的东西,所以我不需要在我的服务器上有一个实际的文件发送?

php phpmailer

15
推荐指数
1
解决办法
2万
查看次数

使用PHPMailer通过SMTP发送电子邮件

我正在尝试使用PHPMailer发送SMTP电子邮件,但我不断收到此错误消息,任何想法如何摆脱它?
我正在尝试通过端口465上的SSL连接.

SMTP -> FROM SERVER: 
SMTP -> FROM SERVER: 
SMTP -> ERROR: EHLO not accepted from server: 

Notice: fputs() [function.fputs]: send of 18 bytes failed with errno=32 Roura p?erušena (SIGPIPE) in /home/www/amazonek.cz/subdomains/library/PHPMailer_v5.1/class.smtp.php on line 494
SMTP -> FROM SERVER: 
SMTP -> ERROR: HELO not accepted from server: 

Notice: fputs() [function.fputs]: send of 12 bytes failed with errno=32 Roura p?erušena (SIGPIPE) in /home/www/amazonek.cz/subdomains/library/PHPMailer_v5.1/class.smtp.php on line 212
SMTP -> ERROR: AUTH not accepted from server: 
SMTP Error: Could not authenticate.
Run Code Online (Sandbox Code Playgroud)

我的代码: …

php smtp phpmailer smtp-auth

14
推荐指数
1
解决办法
10万
查看次数

无法使用PHPMailer发送包含正确字符的电子邮件

我正在尝试使用PHPmailer类发送电子邮件,但我发送的html是空的,或者字符是未配置的,没有重音符号.

<?php
header("Content-Type: text/html; charset=ISO-8859-1", true);
require_once('class.phpmailer.php');
include "config.php";

$nome = trim($_POST['nome']);
$email  = trim($_POST['Imail']);
$usuario = trim($_POST['usuario']);
$senha = trim($_POST['senha']);
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

$mail->IsSMTP(); // telling the class to use SMTP

try {
  $mail->AddAddress($email, $nome);
  $mail->SetFrom('editora@conectfarma.net', 'Conectfarma');
  $mail->AddReplyTo('editora@conectfarma.net', 'Conectarma');
  $subject = 'Guia Rápido de Interações Medicamentosas';
  $sendsubject= "=?utf-8?b?".base64_encode($subject)."?=";
  $mail->Subject = $sendsubject;
 $mensagem  = "<!DOCTYPE html>
<html>
<body>
Bem vindo ao Guia Rápido …
Run Code Online (Sandbox Code Playgroud)

html php email phpmailer

14
推荐指数
1
解决办法
3万
查看次数

如何使用Phpmailer附加图像?

我正在使用phphmailer并附加了一个图像,它只显示图像而不是图像本身这里是我的代码可以帮助你.

$mail->AddEmbeddedImage('2.jpg', '2img', '2.jpg');
$mail->Subject  =  "Order Form:  Contact form submitted";
$mail->Body     =  $body . 'img src="../../photo/2img" ;
Run Code Online (Sandbox Code Playgroud)

注意:我已经删除了html标签,因为我收到错误发送此Q.

php phpmailer

13
推荐指数
1
解决办法
2万
查看次数

PHPMAILER不发送错误并且不发送错误

我想让用户填写一份联系表格,然后发送到我的电子邮箱.但由于某种原因它不起作用.我只是得到一个没有错误消息的空白页面或任何文本和电子邮件也没有发送.

if (isset($_POST['submit']))
{
    include_once('class.phpmailer.php');

    $name = strip_tags($_POST['full_name']);
    $email = strip_tags ($_POST['email']);
    $msg = strip_tags ($_POST['description']);

    $subject = "Contact Form from DigitDevs Website";

    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->CharSet = 'UTF-8';

    $mail->Host       = "mail.example.com"; // SMTP server example
    //$mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
    $mail->SMTPAuth   = true;                  // enable SMTP authentication
    $mail->Port       = 26;                    // set the SMTP port for the GMAIL server
    $mail->Username   = "info@example.com"; // SMTP account username example
    $mail->Password   = "password";        // SMTP …
Run Code Online (Sandbox Code Playgroud)

php smtp phpmailer

13
推荐指数
5
解决办法
7万
查看次数

标签 统计

php ×10

phpmailer ×10

email ×4

smtp ×3

html ×2

formatting ×1

pear ×1

plaintext ×1

smtp-auth ×1