|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) H+ G) ?2 A% ]+ D0 a
Teamcenter二次开发源码分享:创建信封发送邮件
+ s2 A/ h+ k. W% \/ x& j' Q3 b9 U8 C N9 |1 l9 q( o! u I
[mw_shl_code=cpp,true]#include <iostream>5 q1 D2 t: O) Y/ |: ^
#include <sa/user.h>
[5 l2 o, `5 f0 H#include <TC/envelope.h>* B- `" f# p4 G* z9 X( {
#include <tc/tc.h>
; C: R- J' W0 T( W' ]5 M( p3 c$ s t9 Y8 f+ x! ]5 N% D
#include <base_utils/IFail.hxx>
" ~4 Z9 w$ [$ X. X. Q/ F) G% T) J2 P#include <base_utils/TcResultStatus.hxx>
8 |2 V1 Q9 k& e#include <mld/logging/TcMainLogger.hxx>5 O( t1 ], d7 P: Z8 Q
#include <base_utils/ScopedSmPtr.hxx>
5 g6 s7 J2 [6 Z' [' `, B. @% t3 Y0 e+ h6 H- {' y
using namespace std;! j O1 D+ A! A/ l
using namespace Teamcenter;2 f5 V6 ^, D$ R
using Teamcenter::Main::logger;
' P# f6 N+ I* ~8 Y! f
- B, X, N6 Q! ^( i3 w, h) P2 r# ~static void create_envelope_and_send_mail(void)
0 ?* W1 e6 E& f% r- ?$ L6 g{
, v- N% D7 ~ B- q9 Z% W, V* r) Z int ifail = ITK_ok;
X. e; H. T4 ]6 A8 r. | ResultStatus stat;
& P1 x9 q% j, ~9 u t try( v+ i$ j0 p" \! m8 Q, A
{ 0 |( Z" G) h* y1 u4 K' o
scoped_smptr<char> user_name_string;5 T! m$ t6 d" E
tag_t user_tag = NULLTAG;
9 a0 S. _* T& H stat = POM_get_user(&user_name_string, &user_tag);
) i/ T: a+ `4 b+ }
6 a: m! S# T* ~* P+ k0 W2 _, {0 i tag_t envelope = NULLTAG;
) q6 `' k2 h. k stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);8 J* G/ W( q+ Q
4 i# l9 D* C e- g& \& j stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");& B1 |# Z0 `: A
stat = MAIL_add_envelope_receiver(envelope, user_tag);3 S! P' l7 O/ _
stat = MAIL_send_envelope(envelope);5 y+ x8 W) y' p1 ^; d+ @$ s. G7 {
, |# H2 Q% g' b
tag_t mailbox = NULLTAG;' I- s [0 z1 Y( E9 l
stat = SA_ask_user_mailbox(user_tag, &mailbox);+ t& \# f9 {$ m
}
4 M) v0 _% h! L; }5 y. ` catch( const IFail &ex )
d1 V0 D2 m1 _ {" O; |# T: B% d% d
logger()->error( ex.ifail(), ex.getMessage());
- f% p9 h* v" f1 o5 E cout << ex.getMessage() << endl;
; d6 C5 e* Q. i cout << "error " << ex.ifail() << endl; % j. u3 h- S" z+ q: C7 O9 \2 t9 T
}
7 {( B$ @1 m* G9 j H; Q}[/mw_shl_code]$ \ [" T" k9 G. }+ t7 ]) l
|
|