|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 i) Y) F) \+ P) _. c: L2 I' L- \Teamcenter二次开发源码分享:创建信封发送邮件
7 ~' E9 Z) c3 P# b
$ d6 a' _3 [# v[mw_shl_code=cpp,true]#include <iostream>
. Y g5 t) [4 C/ B#include <sa/user.h>, |; m" C# ~8 S) o" A
#include <TC/envelope.h>
+ r8 Z, ^9 b* @$ s% v#include <tc/tc.h>" E0 A' ?! ]4 ?/ d* X5 q* n
{$ |/ Q w/ }- H
#include <base_utils/IFail.hxx># B% {% C2 t/ d7 o$ `
#include <base_utils/TcResultStatus.hxx>
5 w& ?2 u* h; G& W$ D; U+ v#include <mld/logging/TcMainLogger.hxx> e! \ d6 S# ~3 s- V
#include <base_utils/ScopedSmPtr.hxx>- v& j u( ~) W
2 O+ D" E+ Y- N7 F# t4 U: |
using namespace std;. f- \3 p* G: G
using namespace Teamcenter;
N/ G. h! Q9 B$ Zusing Teamcenter::Main::logger;
- g# k% g( Z# ^' O+ R& B, H6 N5 d0 s
static void create_envelope_and_send_mail(void)$ h' U H) }; Z. s4 }7 o' ~+ z' X
{
" H6 f! b3 z: l/ X3 y int ifail = ITK_ok;0 i' s" \& E8 I4 x0 U6 D
ResultStatus stat;; z' |; ~7 [$ K) y
try, i* S2 `2 i5 u" x2 O' w
{
/ O" c5 Y7 i& J1 A% ` scoped_smptr<char> user_name_string;
# I1 X6 M' Y4 ^3 C tag_t user_tag = NULLTAG;
. d j$ X4 K7 o( C# F( i stat = POM_get_user(&user_name_string, &user_tag);
; a8 r) Z) U4 q6 l7 Y
2 T8 S7 d4 ~$ `6 A* { tag_t envelope = NULLTAG;
N4 s( |4 M, k: i! u* K9 J6 U stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
$ w2 e# J# F7 L$ Y0 d0 ?
+ X( |& `. W+ \" r5 t& Z: A( M+ } stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");
$ @! a G1 U/ }- p3 H stat = MAIL_add_envelope_receiver(envelope, user_tag);
2 U/ i- i5 w/ t& m+ Z stat = MAIL_send_envelope(envelope);
8 \# O& q1 H. R& }: w! T6 u+ \7 o: f
6 }5 E3 R; \' ~ [! y, s tag_t mailbox = NULLTAG;
! {4 P/ B u+ ?( h stat = SA_ask_user_mailbox(user_tag, &mailbox);
( N# s) {1 R/ g# g! y5 ^7 {, v4 @ }1 d1 V z$ K b# G5 Y
catch( const IFail &ex )
# I( u L4 u. I; i {
9 M2 V! y/ x S, |3 F logger()->error( ex.ifail(), ex.getMessage());9 `3 ~) g0 o1 U& |
cout << ex.getMessage() << endl;
" @. C3 T* X' P5 ] cout << "error " << ex.ifail() << endl; 7 ] F2 G# ^/ g0 q3 t% G
}
: E4 w2 B; B% A9 B: O" y% W}[/mw_shl_code]
: D: X' L' x9 L& P; r4 k: h& w4 y |
|