如何避免发Email忘记标题或附件

Every one perhaps encountered below situation:
1. When you sent a mail, you forgot to attachment the file you mentioned in the mail. So have to send again.
2. You forgot to write the Subject, so the receiver has to open your mail to read all the content.
 
To prevent this occurs again, you may use the Outlook Macro. The steps list below:
1. Click menu [Tools]->[Macro]->[Security]. And select the [Medium].
2. Click menu [Tools]->[Macro]->[Visual Basic Editor]. Then double click the left node [ThisOutlookSession], then replace the blank code with below:
 
Private Declare Function GetForegroundWindow Lib "user32" () As Long
 
Private Declare Function MessageBox& Lib "user32" Alias "MessageBoxA" (ByVal hwnd&, _
                              ByVal lpText$, ByVal lpCaption$, ByVal uType&)
                             
Const MAX_PATH As Long = 260&
Const API_FALSE As Long = 0&
  
' MessageBox() Flags
Const MB_YESNO As Long = &H4& 'The message box will have a YES and NO button
Const MB_ICONQUESTION As Long = &H20& 'The message box will have the question mark graphic
Const MB_TASKMODAL As Long = &H2000&
Const IDYES = 6 'The return value when the YES button is pressed
Const IDNO = 7 'The return value when the NO button is p
 
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
 
hwnd = GetForegroundWindow()
Dim lngres As String
lngres = IDYES
 
 
'check the attchment
 
If InStr(1, Item.Body, "附件", vbTextCompare) <> 0 _
   Or InStr(1, Item.Body, "attach", vbTextCompare) <> 0 _
   Or InStr(1, Item.Body, "enclosed", vbTextCompare) <> 0 Then
If Item.Attachments.Count = 0 Then
lngres = MessageBox(hwnd, "你可能忘记加附件了。要发送吗?", "提示...", _
MB_ICONQUESTION Or MB_TASKMODAL Or MB_YESNO)
If lngres = IDNO Then Cancel = True
End If
End If
 
'check the subject
If Item.Subject = "" Then
lngres = MessageBox(hwnd, "邮件标题为空,仍然发送?", "提示...", _
B_ICONQUESTION Or MB_TASKMODAL Or MB_YESNO)
If lngres = IDNO Then Cancel = True
End If
 
End Sub
 
After this, click menu [debug]->[compile project1]. Save and close. Restart Outlook.
There will popup a warning dialog, click the [Enable Macros].
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值