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

发布于 2024-11-26 11:50:08 字数 658 浏览 1 评论 0原文

我正在尝试自动发送带有嵌入附件和一些实现 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->{'PassThruHTML'} = 1 行不是哈希引用;

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

I'm trying to automate the sending of an email with an embedded attachment and some text that implements HTML code but it seems that the code that I am using will not allow me to create an HTML bolded text or a unordered list. To double check I created the code in vba then passed it through a vba to perl converter and it matched up with what I had written. Here is the part of my script that handles creating the text and embedded attachment in the email:

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');

I get this error:

Not a HASH reference at line $richStyle->{'PassThruHTML'} = 1;

The main point of this code was so that i could use HTML Tags inside the email

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如何视而不见 2024-12-03 11:50:08

我最好的猜测:

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

来自设计器帮助:

Set notesRichTextStyle = notesSession.CreateRichTextStyle( )

您需要使用会话创建notesRichTextStyle。

My best guess:

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

From the designer help:

Set notesRichTextStyle = notesSession.CreateRichTextStyle( )

You need to create the notesRichTextStyle using the session.

云淡风轻 2024-12-03 11:50:08

我猜您想创建 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

I guess you want to create an HTML mail?
In that case, it would be better to use the MIME entity classes to generate native HTML mails and not to rely on the NotesRichText to HTML conversion.

You can find more info on the MIME entity in the Designer Help: http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=/com.ibm.designer.domino.main.doc/H_NOTESMIMEENTITY_CLASS_OVERVIEW.html

最舍不得你 2024-12-03 11:50:08
$ 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... 或其他东西:/

$ 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

so whatever NotesRichTextStyle returns doesn't like ->{...} so maybe use ->SetProperty... or something else :/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文