|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
! n- u+ f" Y" X+ w5 hTeamcenter二次开发源码分享:创建信封发送邮件: {2 G5 l2 `3 ?" p9 i5 X0 j1 i
! |+ } j, l2 C$ c0 @% V[mw_shl_code=cpp,true]#include <iostream>
9 g9 m0 n# [' T#include <sa/user.h>* ?3 S9 n- S, k- n6 R; u4 d; s/ H# O0 U
#include <TC/envelope.h>
- P4 [( X5 r& L#include <tc/tc.h># N2 ~9 i8 y! N3 H3 W7 u
/ s$ V' `2 V( t4 l2 g9 D#include <base_utils/IFail.hxx>
5 P) _/ G1 `! T: T( X#include <base_utils/TcResultStatus.hxx>
& I& S5 j* s! s* K#include <mld/logging/TcMainLogger.hxx>
6 o B% ]( N: j8 M0 B( h5 E#include <base_utils/ScopedSmPtr.hxx>3 z0 z; V! d' D$ l" G
$ R6 z3 c9 d/ L) {$ Tusing namespace std;- U/ p% V8 @7 b
using namespace Teamcenter;( ]2 `1 @3 Z/ `5 U" K" y# t
using Teamcenter::Main::logger;
6 R& r$ U( W/ g1 \& W
9 q1 a; o& L7 [# istatic void create_envelope_and_send_mail(void)
+ z4 [ `! O) ?% v! i5 X{
2 n5 b) S* J% T- v int ifail = ITK_ok;
. Y& U2 V% H# f/ P ResultStatus stat;
% ~4 Z5 I% G0 g+ O8 D! F5 u$ d try
7 B5 l) S, U0 O( |. ^! ~ { 1 x' T0 ]% V4 c0 G
scoped_smptr<char> user_name_string;
7 F/ _7 a3 n( C tag_t user_tag = NULLTAG;
7 m& J8 {" k+ O( k stat = POM_get_user(&user_name_string, &user_tag);
* g( j7 C) X1 ^) a7 W
7 R- w1 s) j; u7 Z- g( u: l tag_t envelope = NULLTAG;
) j1 ]8 ~9 Y: t9 Z+ f; |0 p stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);5 ?( p* a0 S+ O
. U* f7 y2 W+ {' T$ w1 \7 S
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");. q2 V) U; s4 r \* f
stat = MAIL_add_envelope_receiver(envelope, user_tag);& {4 a1 J; i* y" E
stat = MAIL_send_envelope(envelope);: O7 P) P+ v5 M% \. F
0 ]" F1 ~% Y- i- K* ~) g
tag_t mailbox = NULLTAG;
6 a& |: p- `) g8 H% X5 L9 j1 Z) H* Q stat = SA_ask_user_mailbox(user_tag, &mailbox);0 G8 m( ^0 @1 R% B
}# Z6 B K& z+ o& }- [
catch( const IFail &ex )
" m7 U' M4 w) ? `7 f4 f {
( _5 y% t; Q( F9 s8 g) u logger()->error( ex.ifail(), ex.getMessage());7 _: R, x9 ?" o; ]$ x' ?
cout << ex.getMessage() << endl;$ X& [5 C7 Z5 A; L
cout << "error " << ex.ifail() << endl; : I; q+ b8 e$ i( \1 X2 a
}9 g1 R$ U) w, {6 A3 N; j: U
}[/mw_shl_code]
$ V$ X: A: R/ V, O9 E, i0 j |
|