发新话题
打印

[已解决] 关于CQ邮件发送附件( 此文章被查看:435次,被回复:4篇!! )

关于CQ邮件发送附件

想问下如何实现在CQ中发邮件带附件呢,我使用了CDONTS.NewMail,但是邮件发不出去,都存在本地了.实际上我们CQ其他的邮件通知功能都是好用的.


问题已经解决 [打开主题]
本主题的最佳答案为 [ 2 楼].



© 本文为 Alice_ZhouSCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系管理员

TOP

Sending attachments with e-mail notification
developerWorks
  
Document options
Set printer orientation to landscape mode

Level: Introductory

Rational staff, Staff, IBM

21 Apr 2004

    This is an example of a third-party API hook for IBM Rational ClearQuest.

This item was originally published in May, 2002.

NOTE: This hook is presented only as an example of how to customize your use of IBM® Rational® ClearQuest®. It has not been formally tested, and is not supported by IBM.

Description

The built-in ClearQuest OLEMailMsg object (aka "PAINET.MAILMSG") does not support attachments. If you need to include an attachment in an e-mail message, consider creating an e-mail object from MS Outlook instead. The following code fragment demonstrates how to create such an object, initialize and send it. If you need to attach a ClearQuest attachment to this e-mail, you must first save the ClearQuest attachment to the filesystem (using the Attachment.Load method), and specify its path name in place of "attachment path" below. An example of using the Attachment object can also be found in HOOKS00000419.

Script Language
VB Script
Code
set out=WScript.CreateObject("Outlook.Application")
set mapi=out.GetNameSpace("MAPI")

set mail=out.CreateItem(0)
mail.Recipients.Add(cqrecipient)
mail.Subject = "cq bug..."
mail.Body = "bug description..."
mail.Attachments.Add ("attachment path")
mail.Send

REF: http://www.ibm.com/developerworks/rational/library/3885.html


最佳答案
该回答被楼主/管理员列为正解!



© 本文为 yunshanSCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系管理员

TOP

用vbs发送带附件的邮件

function send_mail(You_Account,You_Password,Send_Email,Send_Email2,Send_Topic,Send_Body,Send_Attachment)
'code by NetPatch
'VBS发送邮件参数说明
'You_Account:你的邮件帐号
'You_Password:你的邮件密码
'Send_Email:  主要邮件地址
'Send_Email2: 备用邮件地址
'Send_Topic:  邮件主题
'Send_Body:    邮件内容
'Send_Attachment:邮件附件
You_ID=Split(You_Account, "@", -1, vbTextCompare)
'帐号和服务器分离
MS_Space = "http://schemas.microsoft.com/cdo/configuration/"
'这个是必须要的,不过可以放心的事,不会通过微软发送邮件
Set Email = CreateObject("CDO.Message")
Email.From = You_Account
'这个一定要和发送邮件的帐号一样
Email.To = Send_Email         '主要邮件地址
If Send_Email2 <> "" Then
Email.CC = Send_Email2        '备用邮件地址
End If
Email.Subject = Send_Topic        '邮件主题
Email.Textbody = Send_Body        '邮件内容
If Send_Attachment <> "" Then
Email.AddAttachment Send_Attachment     '邮件附件
End If
With Email.Configuration.Fields
.Item(MS_Space&"sendusing") = 2       '发信端口
.Item(MS_Space&"smtpserver") = "smtp."&You_ID(1) 'SMTP服务器地址
.Item(MS_Space&"smtpserverport") = 25     'SMTP服务器端口
.Item(MS_Space&"smtpauthenticate") = 1     'cdobasec
.Item(MS_Space&"sendusername") = You_ID(0)    '你的邮件帐号
.Item(MS_Space&"sendpassword") = You_Password   '你的邮件密码
.Update
End With
Email.Send
'发送邮件
Set Email=Nothing
'关闭组件
Send_Mail=True
'如果没有任何错误信息,则表示发送成功,否则发送失败  
If Err Then
Err.Clear
Send_Mail=False
End If
End Function
'以下是利用上面的函数发送带附件的邮件例子
If Send_Mail("[email=test@163.com%22,%22test%22,%22test2@163.com]test@163.com","test","test2@163.com[/email]","","邮件主题","邮件内容","d:\test.exe")=True Then
Wscript.Echo "发送成功"
Else
Wscript.Echo "发送失败"
End If



© 本文为 yunshanSCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系管理员

TOP

当然也可以使用CDONTS.Newmail来发送附件,如下:
Set objMail = CreateObject("CDONTS.NewMail")
objMail.AttachFile "yourfile"

发送不出去,可能是邮箱屏蔽了匿名邮件。

© 本文为 yunshan 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

thx,使用了其中一种解决方法,问题解决了,

© 本文为 Alice_Zhou 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

发新话题