|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; R' }; T% R- t; m+ e9 S& j1 E
Teamcenter二次开发源码分享:创建信封发送邮件
+ k0 J1 V, ]7 S# }! @( f* w w
* M( C. _) L* Q! ]; h[mw_shl_code=cpp,true]#include <iostream>
& [. T) s: @7 O4 Z5 _. e#include <sa/user.h> o8 e. Y0 n: @( p
#include <TC/envelope.h>7 N' V, j( `1 q/ O# {
#include <tc/tc.h>
4 W0 \7 Z+ g+ ]; U6 u8 `) w
. J$ V! m2 c' Q9 X* m0 A#include <base_utils/IFail.hxx>
/ Y' H# e, ]0 L3 _* W#include <base_utils/TcResultStatus.hxx> i; }; C0 u7 ?+ ]+ J$ M
#include <mld/logging/TcMainLogger.hxx>
9 t+ Z# [/ K: @( U! z#include <base_utils/ScopedSmPtr.hxx>/ V* ^4 a- ?! h$ ]8 Y0 M6 p J. O+ J* [
$ E0 K$ g$ C2 c& Uusing namespace std;
* Y. a0 B; i2 I1 E$ D. ~2 H, r. g2 vusing namespace Teamcenter;
' j7 r6 E S3 F$ G# h. wusing Teamcenter::Main::logger;! a; U ^8 j$ q7 b* c
% I4 V7 r7 R! Ostatic void create_envelope_and_send_mail(void)0 x w. S3 J4 T; j! `, C" }/ O
{
. W/ P$ o. o0 ` K int ifail = ITK_ok;" j, L* j& }. @4 i' [3 J6 c
ResultStatus stat;
" n3 A' z1 v" u. N- r+ f% ^ try
_2 Y+ I# ]. \/ N7 | { ! R1 X" t+ R( v2 ]' D; z
scoped_smptr<char> user_name_string;7 E! E# n; \3 {3 U0 f0 D
tag_t user_tag = NULLTAG;1 X3 [0 l+ V; R0 J/ {. w6 R" y
stat = POM_get_user(&user_name_string, &user_tag);
( c* i( a. S) c5 r/ L3 R: K
5 k+ Y0 c! k" s tag_t envelope = NULLTAG;
( y% X) }7 s2 k. ^: j stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
9 J/ ]' F0 W8 x7 W 2 V2 \0 h9 ?( E6 ~1 u0 H3 e$ b
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");# e* g6 }& ?% [- l
stat = MAIL_add_envelope_receiver(envelope, user_tag);( Q/ p1 Y t9 u" o0 W+ k# E9 {; v
stat = MAIL_send_envelope(envelope);0 S4 u Q7 ?* n L) I5 I$ }" X/ ^! N
: Z _% ]' n& o- u8 R
tag_t mailbox = NULLTAG;
/ h9 s. k4 A2 F. D! i2 X+ c+ n stat = SA_ask_user_mailbox(user_tag, &mailbox);
# v# ^6 ^# b; n$ x3 } ?# Y }4 B% ?% V8 D; P) l/ \
catch( const IFail &ex )
3 o" E7 n. ^& Z5 B* s$ P9 K- @ {
* Z: S `. ~; c+ Y) y logger()->error( ex.ifail(), ex.getMessage());
# u3 z" f9 e2 H. Z0 K, B% z cout << ex.getMessage() << endl;0 I' _9 Z& p, j" `) g8 E% O
cout << "error " << ex.ifail() << endl; 3 f& @+ y3 P# X" K8 Z
}
" n V6 A2 r% w P}[/mw_shl_code]1 G" e& }+ c2 y$ Z, V$ E
|
|