|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& H1 J, M3 S4 z4 I% Q
Teamcenter二次开发源码分享:创建信封发送邮件
4 f$ t, o" x0 o7 N+ L9 N, P$ V2 y8 Q- c7 s8 S I# a
[mw_shl_code=cpp,true]#include <iostream>
! b6 p% V N) r0 [* S, C% p- Z! i9 }5 j#include <sa/user.h>
& }" @0 I( z8 @+ E2 ^#include <TC/envelope.h>/ Q D% Z! {9 ~9 |# f1 R j8 p7 A
#include <tc/tc.h># b4 f9 @; \) d, r8 p; y
) q9 P' q* W/ q0 {3 t* h8 p#include <base_utils/IFail.hxx>$ f3 c0 q! p2 S8 @; b# I: ?- {
#include <base_utils/TcResultStatus.hxx>% F3 G. o; V, U; R$ N
#include <mld/logging/TcMainLogger.hxx>
9 e( G! b" C: H) O9 U8 @#include <base_utils/ScopedSmPtr.hxx>5 O' P" y8 q1 ?# S) J
4 M0 Q$ [) S1 ?" U6 E
using namespace std;
1 w. ~' p2 G% t3 susing namespace Teamcenter;. A: E. Q- m, E2 A6 F3 a/ d) M9 b' c
using Teamcenter::Main::logger;4 m5 j# E3 T4 b) k, ^
- k' y, _( `* ?3 u) w+ Mstatic void create_envelope_and_send_mail(void)
, V) ~! q$ |' x3 I1 k{2 H& c9 H' K4 V5 x5 t1 A3 V" J
int ifail = ITK_ok;. a9 d4 F- r& |' a) w& |. H( e& C
ResultStatus stat;
' L! I' M2 y# u- N8 h w3 v try
1 Q8 z% r5 D+ j& B+ P7 D {
6 ? k) E7 {- S/ p5 g$ l scoped_smptr<char> user_name_string;
) a* A+ W/ Q! E' J tag_t user_tag = NULLTAG;" E6 g3 @% D' o0 w7 t& ? i
stat = POM_get_user(&user_name_string, &user_tag);( Y2 ~" d; ^( k4 S* |) T
1 W# B8 n* W* M! ^& n! N
tag_t envelope = NULLTAG;, @: G' S( ?/ u/ v
stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);% [/ i# q a2 g: z) m' O# ^
, S; ~- ~9 C6 ]; l0 @5 C0 Z7 J stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");
3 t; X( l+ f5 a: L( u: O stat = MAIL_add_envelope_receiver(envelope, user_tag);, b3 v- Q5 d' ]
stat = MAIL_send_envelope(envelope);
; L& a# Y. |9 P* p, a7 V' Q; D# w; d% }) C
tag_t mailbox = NULLTAG;
7 e; d/ E5 S; P5 U6 S0 v stat = SA_ask_user_mailbox(user_tag, &mailbox);
. ^) ?& J1 W9 f! b7 O( A0 O }
, G) N) B, s; M catch( const IFail &ex )
9 O5 _6 F- ^$ A4 w) P1 v {7 B5 M0 H4 x% a# S1 b$ Y
logger()->error( ex.ifail(), ex.getMessage());
& R: V; p" K6 h1 H# B8 a2 W cout << ex.getMessage() << endl;0 F' Z- H. {! s& p6 h' j
cout << "error " << ex.ifail() << endl; ' X f+ M- Y8 N3 s' ]4 G1 r
}/ b; k$ {; C4 L$ A o+ J9 m/ j" O
}[/mw_shl_code]; o/ a( T0 [6 P
|
|