简体   繁体   English

Perl sendmail到列表被截断

[英]Perl sendmail to list is truncated

I am working with a perl based cgi pages for a webproject. 我正在为一个Web项目使用基于Perl的CGI页面。 I am encountering a strange problem with sendmail module which happens randomly. 我在sendmail模块中遇到了一个奇怪的问题,它随机发生。

Problem: Sendmail would truncate the emails of the users appended at last. 问题:Sendmail会截断最后附加的用户的电子邮件。 But not always, it happens randomly. 但并非总是如此,它是随机发生的。 I log the email list right before sending email and I don't see anything wrong. 我在发送电子邮件之前立即记录了电子邮件列表,但没有发现任何错误。

Example Image (See Karl's last name is truncated at '.' after his first name.) 示例图片(请参见Karl的姓氏后的“。”被截断。)

在此处输入图片说明

Headers for the email. 电子邮件标题。

  Message-ID: <201305221503.r4MF3dYf022792@pazmo.internal.company.com>
  Subject: < ...>
  MIME-Version: 1.0
  Content-Type: text/plain
  To: <biradavolu.ln@company.com>, <dessimira.ln@company.com>,
  <yun.ln@company.com>, karl.
 Date: Wed, 22 May 2013 10:03:39 -0500
 From: <tool@company.com>
 Return-Path: tool@company.com
 X-MS-Exchange-Organization-AuthSource: eusaamw0712.domain.company.com
 X-MS-Exchange-Organization-AuthAs: Internal
 X-MS-Exchange-Organization-AuthMechanism: 10
 X-MS-Exchange-Organization-AVStamp-Mailbox: MSFTFF;1;0;0 0 0

The logged input before sending email: ( I don't see anything wrong with the format) biradavolu.ln@company.com;dessimira.ln@company.com;yun.lastName@company.com;karl.LastName@company.com; 发送电子邮件之前记录的输入内容:(我认为格式没有任何问题)biradavolu.ln@company.com; dessimira.ln@company.com; yun.lastName@company.com; karl.LastName@company.com ;

use Mail::Sendmail;

# Step 1: Declare the mail variable
%mail = (
    from => 'test@company.com',
    to => 'user1FN.user1LN@company.com;user2FN.user2LN@company.com;user3FN.user3LN@company.com;' . "$requester_email; $responsible_email",
    subject => ... ,  
    'content-type' => "multipart/alternative; "
);

my $toList='user1FN.user1LN@company.com;user2FN.user2LN@company.com;user3FN.user3LN@company.com;' . "$requester_email;";   

# Step 2: Add members to toList based on different conditions
if(condition1)
    $toList= $toList.'user4FN.user4LN@company.com;';
if(condition2)
    $toList= $toList.'user5FN.user5LN@company.com;';

... # few other similar condition statement
...

# Step 3: Assign toList based on different conditions
$mail{ 'to' } = $toList;

# Step 4: Set Body of the $mail
if(sendmail(%mail)){
    print LOGFILE "Mail send successfully to $mail{\"to\"}:  ";
}else{
    print LOGFILE "Mail was not send : Mail list was $mail{\"to\"}  : ";
} 

Wild guess here. 在这里疯狂猜测。 You're hiding the actual lastnames of your users (which is fine), but it could be possible that the "random" truncating is always happening on a user with a space in the last name? 您正在隐藏用户的实际姓氏(这很好),但是对于姓氏带有空格的用户,可能总是会发生“随机”截断吗? Like "St. Pierre". 就像“圣皮埃尔”。 Your string might get truncated right at the space. 您的字符串可能会在空格处被截断。

Let me know if that's possible! 让我知道这是否可行!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM