|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 k# k8 w2 G1 s( k: F
Teamcenter二次开发源码分享:创建信封发送邮件
* u1 d3 q# ]. [$ C
6 f0 ]4 Z* f% t[mw_shl_code=cpp,true]#include <iostream>
# I* n/ r2 k1 ]! |8 O8 U! ?#include <sa/user.h>: g4 {* I. T+ y1 |. L
#include <TC/envelope.h>2 x+ f% j# _2 i8 r
#include <tc/tc.h>
8 V; ]. D5 Z$ B! M) H% q' s, @% n& k- R- r8 U
#include <base_utils/IFail.hxx>* c# _6 Z7 Q" s l: w+ y
#include <base_utils/TcResultStatus.hxx>5 g7 V7 d3 A) m1 k% A2 x0 _
#include <mld/logging/TcMainLogger.hxx>
) I4 Q, w) j ]5 I/ {( [#include <base_utils/ScopedSmPtr.hxx>
& a' U+ t' ~/ ]$ u8 Z$ i% l" A6 g
. {, U" Q3 |3 wusing namespace std;) {" x/ ~- X5 b- a2 u% F# K) |) _! J
using namespace Teamcenter;
6 m9 _" l# i/ A; xusing Teamcenter::Main::logger;
/ L7 J$ K( u1 ^5 e0 C- s8 u* B3 \3 R' r) T
static void create_envelope_and_send_mail(void)8 |' U* V0 B0 `! P
{! o7 ]5 p. |3 D. Z+ H+ ^
int ifail = ITK_ok;. W4 {, _/ a2 t1 _
ResultStatus stat;
" h0 P4 G7 H: `5 O2 l% ^ try( \4 L+ z: a4 ]6 H1 @
{ i% |" F& _, ]4 h( }+ }
scoped_smptr<char> user_name_string;- G5 d! V, E x7 p, [' @" @ q
tag_t user_tag = NULLTAG;* z$ w) R% A$ _5 Y
stat = POM_get_user(&user_name_string, &user_tag);
. u6 { o! C/ v4 j- Q
! }' |. \3 Y# A# M tag_t envelope = NULLTAG;
k* }5 c0 k! w6 ^$ G- Q3 h stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
# ^( R. o- X5 K3 M$ f q- y5 s8 u m4 } " |, \' D9 C8 U' I
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");
}6 K7 x" ?! g4 x3 e+ w | stat = MAIL_add_envelope_receiver(envelope, user_tag);7 h! a: a: V6 ?: P; [
stat = MAIL_send_envelope(envelope);
8 N- c, ?; P1 Z8 c( E
/ Q1 u+ }, W; y; i/ e1 L0 ` tag_t mailbox = NULLTAG;9 W/ f: t% M& q# f5 U: I) E9 }9 ~% ?
stat = SA_ask_user_mailbox(user_tag, &mailbox);% i* A. E" H$ v1 t% Y
}
4 s7 y! r/ v& I' o5 B8 _. P( U catch( const IFail &ex )
' M1 S' j) R8 Z9 u; {2 z# k {4 a" W4 _: {( r! _2 r- [/ w
logger()->error( ex.ifail(), ex.getMessage());* H) L) F& g7 n4 T% }
cout << ex.getMessage() << endl;1 ^ |0 ^: O4 P; Y; o7 a# [+ Y
cout << "error " << ex.ifail() << endl;
p. Y& L5 t- j }. t& V: R; M. e5 b+ {
}[/mw_shl_code]
6 P C2 `+ K( `5 @$ R% I. c |
|