|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 n2 N: d7 N+ x) G1 W) STeamcenter二次开发源码分享:创建信封发送邮件5 D. e: g! q W. Z) f1 M- @
# \$ O% O5 S# n- p4 Z
[mw_shl_code=cpp,true]#include <iostream>
; |+ h8 E; b6 e3 d* |% h( h#include <sa/user.h>3 u* A4 }- w3 ^
#include <TC/envelope.h>
' M: N1 W- Q' M& Y3 u4 Z$ H& D3 X#include <tc/tc.h>
7 G. k" r7 d" d8 n8 l
" _, r, M1 O1 f( I# Q#include <base_utils/IFail.hxx>7 q0 I' U* @- ]; e4 i" @9 k
#include <base_utils/TcResultStatus.hxx>
: z5 H/ U. X! \) U+ x1 U#include <mld/logging/TcMainLogger.hxx>: g% _$ a+ o) k; V- S9 h+ |2 V( Z4 }
#include <base_utils/ScopedSmPtr.hxx>% B% w. @1 z. ^5 D; `% S; y- g0 \- P
& V2 q+ b n/ X$ R( p3 eusing namespace std;
, }9 k( r. u) ? Y+ G* xusing namespace Teamcenter;
8 Y7 a' l2 \0 X. t$ g+ F* Nusing Teamcenter::Main::logger;# o6 y4 D* G% _# x( B: \# h% Z
. b5 ]( }3 o. w8 _/ wstatic void create_envelope_and_send_mail(void)
2 l: `& S, @# [) G+ u{
* p4 J2 t3 [; ^3 E; c# i int ifail = ITK_ok;
0 g! h7 A4 b- ?! c. W ResultStatus stat;/ k$ r& |* P% b y
try' _) C# s& n% {# ^( a
{ + s/ Y3 G& p; F0 B$ O- |# Q
scoped_smptr<char> user_name_string;
1 _8 f$ m6 Q1 i: r) I tag_t user_tag = NULLTAG;! {' w/ ~4 ^) h4 y% f7 J
stat = POM_get_user(&user_name_string, &user_tag);1 I m7 F9 c ]7 U0 P
# f4 q8 z, ?0 v. [ tag_t envelope = NULLTAG;/ L3 z8 w7 V" f4 ~
stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
- l, H" H/ J Y# T- a
$ x W/ j5 t0 [' Q$ T stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");( |0 ^$ A' a: Z% I( ?' `: r7 v
stat = MAIL_add_envelope_receiver(envelope, user_tag);9 Y U3 q0 N. C
stat = MAIL_send_envelope(envelope);8 n8 x' a6 j# b& f8 B( Q9 b% Q
3 |3 q2 L$ M* L tag_t mailbox = NULLTAG;
3 }; r$ m/ e- z& t6 {% P4 o4 y stat = SA_ask_user_mailbox(user_tag, &mailbox);
' R3 e7 }- l7 \$ e7 V- K }/ \, v7 J9 o, O0 r& W& M8 t
catch( const IFail &ex )
8 u- G' j; L8 c Q( F6 n0 \ {
( a, I, T! S% M* W logger()->error( ex.ifail(), ex.getMessage());' q% U3 {) m) ]- T: g& L% T1 p8 U
cout << ex.getMessage() << endl;9 V' |. c- j$ n7 Z+ a, [
cout << "error " << ex.ifail() << endl; 0 o" q+ o7 l& C4 V& ]. E
}2 [1 T1 | `% m( |2 N* A- i
}[/mw_shl_code]
1 j5 M) h7 S3 a" W8 H/ Y& _; @ |
|