使用自动化Lotus脚本代理发送电子邮件(是否可以更改发件人而不是代理签名者)

时间:2017-11-23 02:19:56

标签: lotusscript lotus

Notes ID:

PCSAdmin LSBSAdmin

问题: 我有一个自动发送邮件的代理。我们可以编辑发件人成为其他人而不是签署代理的人吗?

案例:

  1. 目前,代理商已由[PCSAdmin]签署。所以它总会发送 由人打电话" PCSAdmin"
  2. 我想更改为另一个帐户[LSBSAdmin]发送电子邮件,我们可以编辑发件人的脚本吗?或者必须使用[LSBSAdmin]?
  3. 签署代理

    Lotus脚本

        Dim maildoc As NotesDocument
        Dim body As NotesMIMEEntity, header As NotesMIMEHeader, stream As NotesStream
        Dim child As NotesMIMEEntity
        Set stream = s.Createstream()
        s.Convertmime = False
        Set maildoc = db.Createdocument()
        maildoc.Form = "Memo"
        Set body = maildoc.Createmimeentity
        Set header = body.Createheader("Subject")
        Call header.Setheaderval("NOTIFICATION Email")
        Set header = body.Createheader("To")        '   Send to/to
        Call header.Setheaderval("personname")
        Set header = body.Createheader("CopyTo")    '   Copy To/cc
        Call header.Setheaderval("Personname")
        Call stream.Writetext(|<html><body>|)
    
        Call stream.Writetext(|<b>Dear | + lsdoc.Getitemvalue("Name")(0) + |,</b><br>|)
        Call stream.Writetext(|<p>|+ "Attached herewith is the FORM for Application for Renewal of application <b>"+ sadoc.name(0)+|</b>.</p>|)     
        Call stream.Writetext(|<p>| + "Please complete the FORM and send by email to <b>"+MailAddress+"</b>" +_
                 ", with the subject '<b>RENEWAL Application</b>'" + |</p>|)
        Call stream.Writetext(|<p> Thank you </p>|)
        Call stream.Writetext(|<p> </p>|)
        Call stream.Writetext(|Secretary<br>|)
        Call stream.Writetext(|Company<br>|)
        Call stream.Writetext(|<em>(No signature is required on this computer generated document)</em><br>|)
        Call stream.Writetext(|</body></html>|)
        Set child = body.Createchildentity()
        Call child.Setcontentfromtext(stream, "text/HTML;charset=iso-8859-1", ENC_NONE)
        Call stream.Close()
        Call stream.Truncate()
    Set child = body.Createchildentity()
        Set header = child.Createheader("Content-Type")
        Call header.Setheaderval("multipart/mixed")
        Set header = child.Createheader("Content-Disposition")
        Call header.Setheaderval(|attachment; filename="| + xlfilename + |"|)
        Set header = child.Createheader("Content-ID")
        Call header.Setheaderval(|"| + xlfilename + |"|)
        Set stream = s.Createstream()
        If Not stream.Open(template, "binary") Then
            Print "Unable to open " + template
        End If
        If stream.Bytes = 0 Then
        Print template + " has no content"
        End If
        Call child.Setcontentfrombytes(stream, "application/vnd.ms-excel", ENC_IDENTITY_BINARY)
        Call stream.Close()
        Call stream.Truncate()
        Call maildoc.Send(False)
        Print "Email sent"  
        s.Convertmime = True
    

1 个答案:

答案 0 :(得分:2)

查看我的答案to this earlier questionthis question, too以及Knut's answer to yet another question

IBM支持的最佳方法是使用Principal字段,但它并不完全隐藏发件人身份。如果需要这样做,则需要将消息直接写入mail.box文件,而不是使用NotesDocument.Send()方法。在Knut的答案中,有一个链接到Karl-Henry Martinsson的剧本。

请注意,在询问之前在这里搜索会是一个好主意。