|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& z w. K) Y* J/ m4 rTeamcenter二次开发源码分享:创建信封发送邮件/ G) J- `1 z; X' r" P1 {
% S# U' g! [) m4 G# t, e
[mw_shl_code=cpp,true]#include <iostream>; ?3 f& G( |! Z/ l8 ^4 w
#include <sa/user.h>
- Q: Z& O$ m9 T7 T, d$ Q. ?#include <TC/envelope.h>1 @: m( F5 X3 z& [& a, N# q
#include <tc/tc.h>: t# M9 |. F7 ?2 t
) u8 i# ~7 D$ H5 U#include <base_utils/IFail.hxx>7 @: v' ~) c, O8 u9 C
#include <base_utils/TcResultStatus.hxx>
' [ g$ H, ^, X2 M0 M) _& s#include <mld/logging/TcMainLogger.hxx>
' t4 i! D; }) b$ N#include <base_utils/ScopedSmPtr.hxx>5 m8 N* n7 h9 k1 Y( G" A( _
. t8 V7 M2 w5 |4 u+ f7 H6 \ w
using namespace std;8 R6 v( R" U: W* ~1 i0 J
using namespace Teamcenter;- y. S7 I( }, A5 q* J$ {5 g4 C
using Teamcenter::Main::logger;
, x, s0 ]- ]% A/ l* ?( v: H l5 c; b6 f) ~( Q
static void create_envelope_and_send_mail(void)- m$ D3 E( C0 k1 j5 V
{
+ P, D% b- ^: W; U int ifail = ITK_ok;3 r: o: _' U2 U2 a4 ]5 ]2 n9 _, B
ResultStatus stat;
# E* k H- U# U9 K0 \ try
|5 I4 ^* c c& _/ d4 e) | {
) A. D1 {# h! g# y4 E/ _ scoped_smptr<char> user_name_string;1 {" |- d/ }' u5 y/ G3 M: H
tag_t user_tag = NULLTAG;- `! P4 Y0 T4 ]) l; a% w) w
stat = POM_get_user(&user_name_string, &user_tag);
' M; V3 u! Z( R1 N
5 B9 x" q0 F, | L: r8 S tag_t envelope = NULLTAG;
, Y; Z9 G& y- F8 w# S stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
/ h. h. R+ f" s9 _ - Q3 E: v# f5 f9 a3 }) b6 q
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");1 N! `; ?& {# ] O+ G; U6 U+ F, J7 C
stat = MAIL_add_envelope_receiver(envelope, user_tag);4 F5 J& t; s6 m8 K
stat = MAIL_send_envelope(envelope);) Q, D J# ~) r9 V! M
% q. R* G3 w+ ~" I7 U
tag_t mailbox = NULLTAG;2 ~' n0 N* t9 g; X
stat = SA_ask_user_mailbox(user_tag, &mailbox);
* G0 Z% y" y. | }
$ S. R {4 U _; e; n( q" L( ? catch( const IFail &ex )
6 ~+ @' |3 f$ y+ M! C% R0 Y Z {8 b* L5 T( \- g* m4 Y$ L
logger()->error( ex.ifail(), ex.getMessage());+ f; y& _* g0 B4 R7 O9 n
cout << ex.getMessage() << endl;
. q0 }1 q \: S( H cout << "error " << ex.ifail() << endl;
: d- X) c; ?2 e4 l7 |: O' A }& y- E& V, ~ ?. a; q) ]
}[/mw_shl_code]
: s/ E, u9 \ [) V5 y |
|