小编bal*_*man的帖子

phpmailer发送邮件无需SMTP认证

我正在使用 Phpmailer 发送电子邮件。最初,当我通过用户名和密码使用 SMTP 时,它工作正常。如果我尝试不进行 SMTP 身份验证,则会返回连接超时错误。这是我的代码

<?php
require 'PHPMailerAutoload.php';

$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = "relay-hosting.secureserver.net";
$mail->Port = 25;
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;
$mail->setFrom('xxxx@domainname.com', 'First Last');
$mail->addAddress("xxxx@domainname.com", "Recepient Name");
$mail->addReplyTo("xxxx@domainname.com", "Reply");
$mail->isHTML(true);

$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";

if(!$mail->send()) 
{
    echo "Mailer Error: " . $mail->ErrorInfo;
} 
else 
{
    echo "Message has been sent …
Run Code Online (Sandbox Code Playgroud)

php email dns smtp phpmailer

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

XSSF(Apache POI) - 从数据透视表中的单个列值添加多个列标签

我目前正在使用Apache POI 3.12添加数据透视表.这是我的sample.xlsx文件:

在此输入图像描述

现在我使用以下代码为上述数据创建数据透视表.

    File excel = new File("sample.xlsx"); 
    FileInputStream fis = new FileInputStream(excel); 
    XSSFWorkbook wb = new XSSFWorkbook(fis); 
    XSSFSheet sheet = wb.getSheetAt(0); 
    XSSFPivotTable pivotTable = sheet.createPivotTable(new AreaReference("A3:C7"), new CellReference("E3"));
    pivotTable.addRowLabel(0);
    pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 1);
    pivotTable.addDataColumn(1, true);
    pivotTable.addReportFilter(2);
    FileOutputStream fileOut = new FileOutputStream("output.xlsx");
    wb.write(fileOut);
    fileOut.close();
    wb.close();
Run Code Online (Sandbox Code Playgroud)

我的output.xlsx文件包含以下数据透视表:

在此输入图像描述

当我要在excel中编辑数据透视表时,它在页面字段中添加年份列而不是列字段.其实我需要以下结果:

在此输入图像描述

我无法从单列值添加多个列标签.请你帮助我好吗?提前致谢

java excel pivot-table apache-poi

1
推荐指数
1
解决办法
1842
查看次数

标签 统计

apache-poi ×1

dns ×1

email ×1

excel ×1

java ×1

php ×1

phpmailer ×1

pivot-table ×1

smtp ×1