|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 Z# M! p3 j$ h" L/ L( k2 G
Teamcenter二次开发源码分享:创建信封发送邮件
. A% a- g( G3 b" g
# x1 V( ]4 z1 n* j/ N7 T[mw_shl_code=cpp,true]#include <iostream>, `& B1 M0 Z6 a7 Y0 W1 U
#include <sa/user.h>
: n* r8 x* j+ J# U' t8 w8 J#include <TC/envelope.h>
5 x6 D% O" P2 Z W/ g2 t: ]#include <tc/tc.h>* C9 y# [8 W7 n* y* z, @5 p% f
+ c9 o& Y9 S; S: t) Q9 n
#include <base_utils/IFail.hxx>8 N4 z) X1 `9 S: m. r& w' w
#include <base_utils/TcResultStatus.hxx>
9 A9 Z3 z& V5 j" M6 I6 ~#include <mld/logging/TcMainLogger.hxx>+ f8 N, R* v n/ ^! z
#include <base_utils/ScopedSmPtr.hxx>
' w1 [; X! O. Y4 }5 o. J/ s+ [2 N' S: V# o4 W9 w7 C( o1 @8 b
using namespace std;
" P# y* l' f2 Susing namespace Teamcenter;
. W5 a( @" d# Husing Teamcenter::Main::logger;
* V" e1 O$ L/ S7 {( c9 t+ E, P; Q
static void create_envelope_and_send_mail(void)
. ~/ _! v/ w( Q: x{
- S1 p( ?$ O" h$ [9 m6 O" d/ L int ifail = ITK_ok;! J& q% o& R* X7 \
ResultStatus stat;* W5 }2 ? Y2 d8 }
try
6 ] }/ x: U! P7 f { ( S# T& r2 a9 P9 w$ U
scoped_smptr<char> user_name_string;2 p& h7 Q) Q3 U
tag_t user_tag = NULLTAG;
6 t* W9 L; X, e% r: Q8 v stat = POM_get_user(&user_name_string, &user_tag);
# J0 g/ G* Q2 b7 i& N: q E; m7 v3 I3 z7 D7 Q+ {( ~& J
tag_t envelope = NULLTAG;, Q2 r5 ]* ?2 N# b: q0 b+ ]
stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);0 a% {5 M: I0 m- ]& W6 `0 V k
$ g0 X0 A. `3 _/ U
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");/ l& @' e- v! `" j& v
stat = MAIL_add_envelope_receiver(envelope, user_tag);
9 Z) d( \0 c( u/ n0 x stat = MAIL_send_envelope(envelope);8 ^7 b3 w2 w6 [! R- j$ j
% R/ H7 E+ P! \2 ]; T' M tag_t mailbox = NULLTAG;3 H1 M* h8 z3 J
stat = SA_ask_user_mailbox(user_tag, &mailbox);) N& m' }$ B1 @& P* U
}: S+ Q9 g3 S- Y4 ~( i- j- K1 o
catch( const IFail &ex )
9 [# x' Z4 @% M, X9 ] h. U {
. A) _6 ]) r8 H4 I1 ^ logger()->error( ex.ifail(), ex.getMessage());. z# }. D" n" y" I# N0 l
cout << ex.getMessage() << endl;& S0 Z: Y. u. G
cout << "error " << ex.ifail() << endl; % z3 E* G0 {% v( X+ u# O4 w% ~
}: `, a+ f D" U5 U
}[/mw_shl_code]0 f9 T" Z4 ^4 B0 a. q
|
|