简体   繁体   English

VBA Lotus Notes发件人电子邮件地址为CC

[英]VBA Lotus Notes sender email address as CC

I created a makro in excel to send all TODOs to the responsible people. 我在excel中创建了一个Makro,将所有TODO发送给负责人员。 Now I want to add the sender address into the CC. 现在,我要将发件人地址添加到抄送中。 I know how to set the CC but I don't know how to get the current sender address. 我知道如何设置抄送,但我不知道如何获取当前发件人地址。

Set session = CreateObject("Notes.NotesSession")
Set db = session.GETDATABASE("", "")
Call db.OPENMAIL
Set doc = db.CREATEDOCUMENT
Call doc.REPLACEITEMVALUE("CopyTo", strEmail)

I think it should work with the notes session, but I didn't find any method for this. 我认为它应该与notes会话一起使用,但是我没有找到任何方法。

You can just use NotesSession.UserName() . 您可以只使用NotesSession.UserName() This is Notes mail you are sending. 这是您要发送的Notes邮件。 You don't need a full SMTP-style address with the @ and the DNS domain name. 您不需要带有@和DNS域名的完整SMTP样式地址。 You can just put the user's Notes username in an addressing field and the Domino router will do the lookup and it will just work. 您可以仅将用户的Notes用户名放在地址字段中,然后Domino路由器将进行查找并且将正常工作。

The above is true as long as (a) the server that you have established the session with is either the user's home mail server, a member of the same Notes domain (which is not the same thing as a DNS domain), or a member of a Notes domain that includes the user's Notes domain as part of its Directory Assistance (or its cascading address book list if it's using 20-year-old configurations), and (b) the username is unique within the above scope. 只要(a)与之建立会话的服务器是用户的家庭邮件服务器,同一Notes域的成员(与DNS域不同)的成员,上述条件就适用包括用户的Notes域作为其目录服务(如果使用的是20年的配置,则是层叠的通讯录列表)的一部分的Notes域,并且(b)用户名在上述范围内是唯一的。

another suggestion, copy sender from last sent mail, to test 另一个建议,从最近发送的邮件中复制发件人,以进行测试

Set view = db.GetView("(($Sent))")
Set sentdoc = View.GetLastDocument
sender=sentdoc.getItemValue("From")

The way I automated Lotus Notes and sending emails was using this site below: 我自动化Lotus Notes和发送电子邮件的方式是使用以下站点:

Send files using Lotus Notes 使用Lotus Notes发送文件

The area you want to pay attention to is at the bottom, which takes "noDocument" and adds the relevant titles "Subject", "to", "Sendto" etc. 您要注意的区域位于底部,该区域带有“ noDocument”,并添加相关标题“ Subject”,“ to”,“ Sendto”等。

'Add values to the created e-mail main properties. '将值添加到创建的电子邮件主要属性中。

 With noDocument
    .Form = "Memo"
    .SendTo = vaRecipients
    .CopyTo = vaCopyTo
    .Subject = stSubject
    .Body = vaMsg
    .SaveMessageOnSend = True
    .PostedDate = Now()
    .Send 0, vaRecipients
  End With

Use NotesSession.userName() to get the current username. 使用NotesSession.userName()获取当前用户名。 If you really want the full email address you might also be able use @namelookup formula. 如果您确实想要完整的电子邮件地址,则也可以使用@namelookup公式。

However, I would stay away from accessing notes via COM as it does not work on 64bit and IBM couldn't care less about it. 但是,我不会通过COM访问注释,因为它在64位上不起作用,IBM对此也不太在乎。 I had several excel files which used this handy technique, but they are all broken since we moved to 64bit. 我有几个使用此便捷技术的excel文件,但是自从我们移至64bit以来,它们都被破坏了。 Check this old kb https://www-304.ibm.com/support/docview.wss?uid=swg21454291 检查这个旧的kb https://www-304.ibm.com/support/docview.wss?uid=swg21454291

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

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