使用perl自动化Lotus Notes文本样式?

时间:2011-07-27 13:04:05

标签: perl lotus-notes ole

我正在尝试自动发送带有嵌入式附件的电子邮件和一些实现HTML代码的文本,但似乎我使用的代码不允许我创建HTML粗体文本或无序列表。要仔细检查,我在vba中创建了代码,然后通过vba传递给perl转换器,它与我写的内容相匹配。以下是我的脚本中处理在电子邮件中创建文本和嵌入附件的部分:

my $richStyle = $Document->NotesRichTextStyle();
$richStyle->{'PassThruHTML'} = 1;

my $Body = $Document->CreateRichTextItem('Body');

$Body->AppendText(">>EOT");
$Body->AppendStyle($richStyle);
**$Body->AppendText("<b>HELLO</b>");**
$Body->EmbedObject(EMBED_ATTACHMENT,'','$filename','$name');

我收到此错误:

  

$ $ RichStyle-&gt; {'PassThruHTML'} = 1;

行不是HASH引用

此代码的要点是我可以在电子邮件中使用HTML标签

3 个答案:

答案 0 :(得分:1)

我最好的猜测:

my $richStyle = $Document->NotesRichTextStyle();

来自设计师的帮助:

Set notesRichTextStyle = notesSession.CreateRichTextStyle( )

您需要使用会话创建notesRichTextStyle。

答案 1 :(得分:1)

我想你想创建一个HTML邮件? 在这种情况下,最好使用MIME实体类来生成本机HTML邮件,而不是依赖于NotesRichText到HTML的转换。

您可以在Designer帮助中找到有关MIME实体的更多信息:http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=/com.ibm.designer.domino.main.doc/H_NOTESMIMEENTITY_CLASS_OVERVIEW.html

答案 2 :(得分:0)

$ perl -Mdiagnostics -e " []->{1}=2 "
Not a HASH reference at -e line 1 (#1)
    (F) Perl was trying to evaluate a reference to a hash value, but found a
    reference to something else instead.  You can use the ref() function to
    find out what kind of ref it really was.  See perlref.

Uncaught exception from user code:
        Not a HASH reference at -e line 1.
 at -e line 1

所以无论NotesRichTextStyle返回什么都不喜欢->{...}所以也许使用->SetProperty...或其他:/