|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) D2 J" P& l* R0 _- a
Teamcenter二次开发源码分享:创建信封发送邮件
4 E& E9 g* z) f( ]) o9 g
5 j" |( i- e O4 Z& g0 c- e9 b[mw_shl_code=cpp,true]#include <iostream>9 f. {* ^5 Z0 N" l
#include <sa/user.h>: h7 _ F4 S: R N7 e6 `, ]9 {
#include <TC/envelope.h>, A8 K" [( A' K$ O% _
#include <tc/tc.h>
# ~9 n' S3 Q2 M- e. O/ l6 a$ G8 K0 x2 c+ J5 [, q' Z
#include <base_utils/IFail.hxx>" W/ g6 a7 e' Q, Y1 c( I; ?
#include <base_utils/TcResultStatus.hxx>
: m& A/ M" }* b, n0 y) k#include <mld/logging/TcMainLogger.hxx>4 V+ q3 F5 C0 W* F& p% ~- @+ C) e
#include <base_utils/ScopedSmPtr.hxx>
% ]' q/ ?3 w9 R1 v4 h% \" t/ T
; j- G5 G' Q9 `4 d* G3 U. a; jusing namespace std;) }, M0 k+ i* o* h
using namespace Teamcenter;& d- q8 {$ [7 b" t& W, L
using Teamcenter::Main::logger;
3 S! r& ]8 o" p) @/ s" b
9 N* A! R' y* S! a0 O3 f4 i* Qstatic void create_envelope_and_send_mail(void)$ C E" o% \% T
{
" P v) l7 c5 l8 F2 P int ifail = ITK_ok;
" G: x9 ]8 ?# @0 j ResultStatus stat;
- }, N8 {# \) H+ O2 b3 p: T try
4 e0 |6 Z" G% j# Z1 I { + B u; k1 M! _) [, J4 j0 Y1 t% K
scoped_smptr<char> user_name_string;% E$ u- T D0 S! C4 _/ ^
tag_t user_tag = NULLTAG;
2 [1 {3 _8 R: R P& e. W stat = POM_get_user(&user_name_string, &user_tag);+ w/ M1 Q: ?8 | D' q
0 x; l/ U: h5 o5 N# E; x. ^
tag_t envelope = NULLTAG;3 v/ m& n! P- \3 N
stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);; w4 H1 s) ^" X- G7 K: d6 _
' @* d4 C& d1 g: A) z; j
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");
. O+ c) y& h) h stat = MAIL_add_envelope_receiver(envelope, user_tag);
( L5 ]- r( k" L" @8 a stat = MAIL_send_envelope(envelope);. p; T; a1 M3 I0 b* y* I; w
! J3 w/ P2 v3 N tag_t mailbox = NULLTAG;/ f# ]+ M. s6 }/ z; N. s
stat = SA_ask_user_mailbox(user_tag, &mailbox);* f5 ~9 @5 ?2 L9 o! i
}
% p$ a% L @4 p catch( const IFail &ex )' A$ x+ A' r0 s" D9 O; M0 \
{
0 R# S4 i/ S( @2 K logger()->error( ex.ifail(), ex.getMessage());. L5 u5 ], i! D r$ r6 C# g
cout << ex.getMessage() << endl;" k+ | X2 N- Q7 I6 I2 ~9 `0 G% C/ Z
cout << "error " << ex.ifail() << endl;
: _6 z; t1 h, `- H& d }. o5 v7 g1 f; ?
}[/mw_shl_code]
& Z1 F0 l; B9 q, {/ j2 V4 q |
|