【问题标题】:Adding Signature to Email Outlook将签名添加到电子邮件 Outlook
【发布时间】:2015-09-08 21:56:17
【问题描述】:

嘿,我正在尝试将我的默认签名添加到自动生成的电子邮件中,我能够做到这一点的唯一方法是使用 .Display(Mailitem) 并从中获取签名。

我想知道是否还有其他不涉及显示任何内容的方法。

If sEmailAddress.Contains("@") Then
    Dim objOutlook As Object
    Dim objMailMessage1 As Outlook.MailItem
    Dim signature As String
    objOutlook = CreateObject("Outlook.Application")
    objMailMessage1 = objOutlook.CreateItem(0)
    With objMailMessage1
        .To = "richard@Sortmypc.co.uk"
        .Display(objMailMessage1)
        '  .Close()
        signature = .HTMLBody
        .HTMLBody = "<p>" & sEmailGreeting & " " & sLeadName & "</p>" & vbCrLf & vbCrLf & "<p> Many Thanks for your enquiry, I can confirm our fee to carry out the Home Report would be " & "£" & sHomeReportTotal & " including VAT.</p>" & vbCrLf & vbCrLf & "<p> We provide Home Reports at a time to suit you with early morning, evening and weekend appointments. <b> We have availability this week/weekend </b> and are more than happy to have a chat whenever is convenient with you and talk you through the home report process. </b>" & vbCrLf & vbCrLf & "<p><font color=red> Our team of in-house RICS qualified Surveyors </font> who all have local knowledge and provide a professional service.  The Home Report Company also prides itself on a quick turnaround, so unlike some traditional chartered surveying practice we also ensure that all reports are with our clients within 2 working days.</P>" & vbCrLf & vbCrLf & "<p>Fully insured and regulated by RICS, we understand that selling your home can be an expensive and stressful time and we want to take some of that pressure away from you. So that is why we are open from early in the morning until late in the evening as well as at the weekends so if you have any questions regarding your Home Report then there is someone here to answer those questions.</p>" & vbCrLf & vbCrLf & "<p>We also understand Home Report Costs can be expensive and that is why we are one of the most competitive in the market.</p>" & vbCrLf & vbCrLf & "<p>Once again we thank you for your enquiry, and if you have any questions please let me know</P>" & vbCrLf & vbCrLf & "<p>Look forward to hearing from you.</p>" & vbCrLf & vbCrLf & "<p>Kind Regards </p>" & vbCrLf & vbCrLf & "<p>Louise</p>" & "<p>" & signature & "</p>"
        .Subject = "Scottish Home Reports quote -" & sLeadName

        '  .Display()
        '  .Save()
        .Send()
        sEmailSent = "Good Evening " & sLeadName & "" & vbCrLf & vbCrLf & "Many Thanks for your enquiry, I can confirm our fee to carry out the Home Report would be " & "£" & sHomeReportTotal & " including VAT." & vbCrLf & vbCrLf & "We provide Home Reports at a time to suit you with early morning, evening and weekend appointments.  We have availability this week/weekend and are more than happy to have a chat whenever is convenient with you and talk you through the home report process." & vbCrLf & vbCrLf & "Our team of in-house RICS qualified Surveyors who all have local knowledge and provide a professional service.  The Home Report Company also prides itself on a quick turnaround, so unlike some traditional chartered surveying practice we also ensure that all reports are with our clients within 2 working days." & vbCrLf & vbCrLf & "Fully insured and regulated by RICS, we understand that selling your home can be an expensive and stressful time; and we want to take some of that pressure away from you. So that is why we are open from early in the morning until late in the evening as well as at the weekends so if you have any questions regarding your Home Report then there is someone here to answer those questions." & vbCrLf & vbCrLf & "We also understand Home Report Costs can be expensive and that is why we are one of the most competitive in the market." & vbCrLf & vbCrLf & "Once again we thank you for your enquiry, and if you have any questions please let me know" & vbCrLf & vbCrLf & "Look forward to hearing from you." & vbCrLf & vbCrLf & "Kind Regards" & vbCrLf & vbCrLf & "Louise"
    End With
    SaveLead()
End If

【问题讨论】:

    标签: vb.net outlook


    【解决方案1】:

    如果您在 Outlook 中创建签名,它将保存三个文件(HTM、TXT 和 RTF)到:

     C:\Users\<UserName>\AppData\Roaming\Microsoft\Signatures
    

    您可以使用以下代码获取签名内容:

     Function GetBoiler(ByVal sFile As String) As String
      Dim fso As Object
      Dim ts As Object
      Set fso = CreateObject("Scripting.FileSystemObject")
      Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
      GetBoiler = ts.readall
      ts.Close
     End Function
    

    有关更多信息和示例代码,请参阅Insert Outlook Signature in mail

    【讨论】:

    • 图片中没有这种方式
    • 有没有办法让图像也被扔掉@EnugneAstafiev
    • 投反对票 - 代码是 VBA(Visual Basic for Applications),而不是 VB.NET(Visual Basic .NET),因为问题的代码和标签清楚地存在。
    猜你喜欢
    • 2017-09-08
    • 2016-10-18
    • 2015-11-19
    • 2013-10-06
    • 2018-01-04
    • 1970-01-01
    • 2014-07-26
    • 2011-11-15
    • 2021-07-16
    相关资源
    最近更新 更多