|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
u9 _9 w, V( E! V
Teamcenter二次开发源码分享:创建信封发送邮件- T( U6 p3 J- d) P( I; Z5 t
: E& b3 I( G5 c; O9 r0 k6 K7 U/ x
[mw_shl_code=cpp,true]#include <iostream>/ v$ ]/ Y2 a$ B; B% V7 c
#include <sa/user.h>; K! M3 m3 z' f( W
#include <TC/envelope.h>1 e/ M8 B- E) X" [. A0 b3 I
#include <tc/tc.h>
2 K9 @- [0 _0 u2 e$ }1 D3 h
6 o. _9 R/ ]& r: v#include <base_utils/IFail.hxx>! z. G/ J7 o5 Y8 O8 @4 C7 B
#include <base_utils/TcResultStatus.hxx>
, Q) h7 w0 c9 r3 c, p3 c/ O#include <mld/logging/TcMainLogger.hxx>8 Y% v) {2 d6 A. Q6 ^. V6 O
#include <base_utils/ScopedSmPtr.hxx>
# z3 i+ k" l* [3 ? o e
; E3 ?4 z2 e1 j# Fusing namespace std;
4 H; J3 \, d" |7 iusing namespace Teamcenter;
2 U) I/ a: _, m8 k$ S; zusing Teamcenter::Main::logger;4 P- I1 n& k! k. U1 B; a. N
8 E8 R$ F! L& k/ B9 `4 istatic void create_envelope_and_send_mail(void)
2 n2 I9 l, x6 @1 e( b* k! t) w' R1 e{. k% i$ I" L' Z. M% R) I
int ifail = ITK_ok;* P% D: Y" }3 |1 Z& U
ResultStatus stat;
+ [! @, G& m. Y try; Q$ k2 R o4 B. J8 C3 U4 o& k
{
, R2 h9 H& \6 k: v; E4 @8 V scoped_smptr<char> user_name_string;
s9 p8 U8 M( T; D+ ?6 q- w tag_t user_tag = NULLTAG;+ Q1 I, Q# y! Q2 Z
stat = POM_get_user(&user_name_string, &user_tag);9 m( R0 a1 b7 B( Z: z' C9 n( x' G
O0 _7 p x. |9 b5 \# m/ D! Y, ? tag_t envelope = NULLTAG;
3 Z, l; W+ ?7 @" a) F$ g stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
4 L7 s2 R; z2 @- d; R 9 x# j! O& E. }6 F1 `6 B6 g- r, S- B
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");
3 g/ O& W$ ]& c! w9 X3 p4 ]/ s: ]& a stat = MAIL_add_envelope_receiver(envelope, user_tag);
o8 |" E, R% ~3 }( E stat = MAIL_send_envelope(envelope);
" ^9 |; a# n: H- H2 x! p6 H( H0 _3 _/ h: [6 {( Z# X: [" O) m8 }- M
tag_t mailbox = NULLTAG;, F$ V* t" W9 ?4 t) \5 {$ f) g
stat = SA_ask_user_mailbox(user_tag, &mailbox);
7 {; {+ L/ q3 g& @* w! n }* b8 v2 |# V5 W
catch( const IFail &ex )
, s, S9 v! N8 O' X; `$ V: i {/ }' ~/ j3 ^% z% l
logger()->error( ex.ifail(), ex.getMessage());
8 C3 c# R$ X' _9 J# n% m) ?# o cout << ex.getMessage() << endl;& D3 s5 F) Q* L# W* [! u' d
cout << "error " << ex.ifail() << endl;
% l" t1 o0 z. x c }. o' C* t) y* b! {/ U
}[/mw_shl_code]
/ l/ W) T9 j% Y7 R# h3 z |
|