|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
' S4 B' z; e4 n* }5 Y0 n
Teamcenter二次开发源码分享:创建信封发送邮件5 e# G8 g0 h) s7 X( t
1 @. F; _: J0 o+ @, L
[mw_shl_code=cpp,true]#include <iostream>
* A7 c6 @' ?, _. u8 ?* j#include <sa/user.h>5 |# B( S1 R. ]+ R3 A' O6 R
#include <TC/envelope.h>" }9 E- u! M) ]6 P
#include <tc/tc.h>
) T3 k# a0 Z+ Z5 X' U9 n2 J& V4 a+ z6 c, u9 c9 d
#include <base_utils/IFail.hxx>
$ }( h$ C, e9 @! H: F- R# U#include <base_utils/TcResultStatus.hxx>
, H# S: i: R' J+ i% K' C#include <mld/logging/TcMainLogger.hxx>1 @ ? w* v; j& i6 F
#include <base_utils/ScopedSmPtr.hxx>
/ `: K9 ~1 L8 O; |; q% ]' q y: X l3 }4 d. w
using namespace std;& C% o! p3 j. W. @3 ] v* n4 L4 l
using namespace Teamcenter; c4 y- q- s, w2 t: d! |
using Teamcenter::Main::logger;6 `) _+ n% M x' A3 R+ ^9 H
; P3 A6 H3 ^6 F4 k: ^
static void create_envelope_and_send_mail(void)
# ^4 o9 A! K* t# c+ A W( \$ y{
1 k& ?& r( B% ^4 i int ifail = ITK_ok;9 v9 `2 u. J$ W2 S( i1 g
ResultStatus stat;
. ]* k; e( H2 @* X7 R try
* `4 O4 @$ l: P5 g5 g {
* L- R3 |+ h8 l2 i0 q* R; I0 N+ P scoped_smptr<char> user_name_string;
0 A, E( v1 D* c4 M* r tag_t user_tag = NULLTAG;
; V* N* u7 ^* U) H0 P stat = POM_get_user(&user_name_string, &user_tag);) P1 ~" ~; o5 b* i
1 |6 j1 w5 C2 U9 Q7 Q& A+ N2 @! k tag_t envelope = NULLTAG;+ S- I2 A- E6 ]$ j
stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
4 w! w# w7 |6 w1 n( A
. k- x* z7 m5 q: ~: y4 x4 d5 Y stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");& D* ~* c. c6 W O i8 s
stat = MAIL_add_envelope_receiver(envelope, user_tag);$ i9 T W: l) L7 E4 Z
stat = MAIL_send_envelope(envelope);
! @: D- z$ d6 N* v5 O5 c( h2 k: [7 M1 z; N; A
tag_t mailbox = NULLTAG;4 z; a1 }& i$ v- P$ u* Y
stat = SA_ask_user_mailbox(user_tag, &mailbox);# u' S9 f& R, p& z$ H& l
}% L% f P9 p% w) n" T; t; V* o f
catch( const IFail &ex )
/ q% u5 _6 H* y {
( @1 W) V! m* z! q9 d( e1 b logger()->error( ex.ifail(), ex.getMessage());
* x a$ Y Y5 }. D+ o; F cout << ex.getMessage() << endl;# t7 X. S6 G# J
cout << "error " << ex.ifail() << endl;
0 x" N: i/ @ ?7 i* j }. b! F& c3 {3 m0 F- D# o) c
}[/mw_shl_code]
$ H! g( h. R0 A2 F |
|