|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 ?. P5 U5 D- g7 qTeamcenter二次开发源码分享:创建信封发送邮件
( q# l1 y" J2 f" w! Y
- b: o t: t' {" @" H[mw_shl_code=cpp,true]#include <iostream>
! p% [$ J3 l, D+ V2 R6 u#include <sa/user.h>
3 ]4 m" e0 w- Y& q6 d- m6 z. y#include <TC/envelope.h>
5 B* U% w* z; ~" x5 t#include <tc/tc.h>: z) c( Z* g& f% }$ _; K* I+ x
/ n( A8 s, ^( @' l' i4 i, V% T#include <base_utils/IFail.hxx>
; Z g/ ^7 D3 }: F3 M6 W#include <base_utils/TcResultStatus.hxx>
$ g$ C2 o/ b5 d2 {$ J' i: w: x0 e#include <mld/logging/TcMainLogger.hxx>3 V( z& o- H }+ \" M7 {
#include <base_utils/ScopedSmPtr.hxx>+ F- k3 y8 `0 F K- f( O0 }
. D7 R1 l' k- v7 W1 y8 z! Iusing namespace std;7 F# E6 E( Y% c6 ^8 Z; {, |( y
using namespace Teamcenter;
- \5 a( d7 w8 K: P: F9 Gusing Teamcenter::Main::logger;& g, M% e. E6 x' s' }0 ?$ ]: a) T+ a
2 O ^/ u( J" P% }' T. V
static void create_envelope_and_send_mail(void)
% q; Z0 M% B8 y{# s# z+ t( J5 p9 ]' w# x
int ifail = ITK_ok;
. R3 }, w2 H7 l5 U! { ResultStatus stat;0 K, `) v- W. n
try3 A1 E% m$ f- o
{
+ r5 _" H5 A* ] Z3 f4 V% r, d; r scoped_smptr<char> user_name_string;- t" E1 |8 Q6 O* H) d7 K- z
tag_t user_tag = NULLTAG;
( J8 }9 a. z2 u$ {9 v% z! ]' V6 Y stat = POM_get_user(&user_name_string, &user_tag);$ K. E1 h- Z" c& w
" i! I8 {+ G4 B. ]3 K# n4 y tag_t envelope = NULLTAG;
. ]. _1 J+ d v* p7 Z stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);! Q2 ^! T$ x2 W
7 I. O8 E% S# _! Z! `0 m stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");
) `; l1 l8 p; ?1 F. M/ I stat = MAIL_add_envelope_receiver(envelope, user_tag);
% ?6 W* R& t* D stat = MAIL_send_envelope(envelope);9 R$ F; u3 u. F& j, K6 Z6 Q
& k) d( z; x5 @
tag_t mailbox = NULLTAG;
7 m4 D& W% s9 R4 @. S% c8 d4 @ P1 ? stat = SA_ask_user_mailbox(user_tag, &mailbox);. }6 \0 R$ p- |- F# M( e ~+ |
}' `% x( D6 W3 X# z e/ U
catch( const IFail &ex )
; x" z3 X9 ~1 u2 n {9 S3 k# X, e4 S
logger()->error( ex.ifail(), ex.getMessage());3 u7 [/ k2 p$ f# a
cout << ex.getMessage() << endl;' H9 `% D! b! u6 y5 P& y
cout << "error " << ex.ifail() << endl; ! Z( U9 Z" Y& u3 o7 G( a
}5 x4 f- X8 p* X
}[/mw_shl_code]
1 `9 y A. C" d% ]& A! @ |
|