|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
% ~" \- `; `( [# n0 ~4 e: S- O0 t S1 kTeamcenter二次开发源码分享:创建信封发送邮件
) S5 t; o; E" X, |
" i, c* n S! v[mw_shl_code=cpp,true]#include <iostream>
1 R5 C- A2 {. _- C0 [' c9 S7 A' @#include <sa/user.h>7 n" t2 b1 W c: C$ k. E- d8 d
#include <TC/envelope.h>
& M8 E/ f# Z0 }#include <tc/tc.h> C8 g9 y, L6 b X, r8 P
7 U' F# G, A; J/ H$ O. ?. V#include <base_utils/IFail.hxx>5 O+ n9 h, k% O
#include <base_utils/TcResultStatus.hxx>
, ^1 @' `4 q; h3 q# C! {& V#include <mld/logging/TcMainLogger.hxx>
1 e U. B3 J/ g# D! ^( u- t9 e$ D#include <base_utils/ScopedSmPtr.hxx>
* v$ P j5 ~: F, X' g2 \3 B2 A
' @. @7 w! Q9 `, ?4 Iusing namespace std;
) m& }" ~( N: l7 g! ?# @$ D' Tusing namespace Teamcenter;
* w: v& i7 x& F$ c$ n: m. H4 |using Teamcenter::Main::logger;3 _! a q& n) @1 z
( \+ y- f+ T8 _ T5 ]
static void create_envelope_and_send_mail(void)% p# s6 t2 G, }! n, k
{1 n% o. o0 ?* k1 w
int ifail = ITK_ok;& [: l1 `( g c2 G* V
ResultStatus stat;" e- o2 H% j* v' \' {5 S/ K
try7 V( W) g9 U. T; p4 \
{ + P: E @; D3 k8 I- @9 d
scoped_smptr<char> user_name_string;1 M) M7 I, |* w+ B
tag_t user_tag = NULLTAG;+ e1 ]: N r. U; b
stat = POM_get_user(&user_name_string, &user_tag);3 [9 p6 A# S H; l8 x: x
0 q. _: e9 m& g# T: ? tag_t envelope = NULLTAG;( h/ q R y3 \1 x! b/ ?5 L
stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
& M6 w! x6 B5 W' J+ T$ }4 M7 ~* L
7 I7 f2 W, k8 l1 q7 d% O+ K" w h stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");0 r+ D& S* D/ |5 k7 f, E
stat = MAIL_add_envelope_receiver(envelope, user_tag);3 Z. U/ w5 a' V% @; I1 f2 B
stat = MAIL_send_envelope(envelope);; C( g( E( B8 |; t i5 |
# J8 R. x1 L7 d5 }1 H' E0 t& e
tag_t mailbox = NULLTAG;
% r" r7 q; ?7 f$ t9 z; X# c7 C# k stat = SA_ask_user_mailbox(user_tag, &mailbox);2 M2 D* x+ y6 t& {& M
}" s- G* H" K7 p5 ^
catch( const IFail &ex )4 O) s' G. V/ ~
{
% T3 W5 }% L6 K& K \ logger()->error( ex.ifail(), ex.getMessage());
: K: ?/ W* l: S, _& Z cout << ex.getMessage() << endl;
+ |: Z D( E+ x7 ]# R cout << "error " << ex.ifail() << endl;
% t4 `8 R, p/ a; a( [# G }
9 c& Z4 |5 j7 G1 C- _; A}[/mw_shl_code]% C- e1 W) D+ l3 n* a
|
|