|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 x" U% u' g' t* E3 u
Teamcenter二次开发源码分享:创建信封发送邮件
& b+ X+ ]8 w! X0 G4 B
% |( M' R2 u$ J, S3 J, m+ r: B8 d* s[mw_shl_code=cpp,true]#include <iostream>
- ?0 l3 j( U( S2 a$ D6 s#include <sa/user.h>
$ {, s5 Z3 t3 K8 E% {#include <TC/envelope.h>$ g1 o$ X$ F$ A' G
#include <tc/tc.h>8 F/ F5 k' F0 I5 C
' V8 x. e4 x: b+ ?0 u/ D! y
#include <base_utils/IFail.hxx> @8 M F( l" v1 S
#include <base_utils/TcResultStatus.hxx>
0 W$ ~6 i; C$ ]. |+ D' h/ W#include <mld/logging/TcMainLogger.hxx>5 e% }) E1 K* \! o
#include <base_utils/ScopedSmPtr.hxx>
3 S5 b! B+ U' e7 C* g, t) }/ U9 Y, j4 r
using namespace std;
# V2 x8 K. N) ]$ E' ?' {using namespace Teamcenter;, v7 Z4 g; D* j5 L
using Teamcenter::Main::logger;
; p$ ]0 I* x0 K
- Y/ _' t& w3 @; t9 [static void create_envelope_and_send_mail(void)
/ ?. p8 B" Q# x{+ m! W& |+ h O: ]* }) K7 O: H
int ifail = ITK_ok;
# u2 E# R! i7 R2 Q% ] ResultStatus stat;7 x- S! Z7 d+ K' j6 m7 Q
try& N0 k, t% C& j3 p8 j v0 M0 ^
{ / W- h& q# z$ n- j9 n9 N, G
scoped_smptr<char> user_name_string;6 d$ x1 C/ B. i6 O9 F+ u1 C) Z
tag_t user_tag = NULLTAG;
. F' V) U# ]( _0 T) t stat = POM_get_user(&user_name_string, &user_tag);
/ B/ f1 H4 X0 _+ i0 g! S% P5 S( `' K4 a% U; c) n5 K ?+ T
tag_t envelope = NULLTAG;7 `$ B6 S5 u2 a
stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);2 T- R0 W3 C m
, I7 [& g9 W0 I
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");( q b3 q' z: H" t7 K
stat = MAIL_add_envelope_receiver(envelope, user_tag);
% N$ ?# T/ h8 p G stat = MAIL_send_envelope(envelope);
$ j4 V& u5 j4 W7 a: {/ |
- a. K6 J3 [/ J, X2 m _# U tag_t mailbox = NULLTAG;
* V. Z. x6 e6 M' Q: K; S3 ` stat = SA_ask_user_mailbox(user_tag, &mailbox);+ O" ?! _. P$ l2 g" L$ z" ^
}3 @7 g! Z* S" H2 n% U
catch( const IFail &ex )+ o7 I" n( \8 f( @ q& S
{9 w* e" y, k ` z) S% K1 F$ Q5 C
logger()->error( ex.ifail(), ex.getMessage());
2 o. |6 W( M: D) @ cout << ex.getMessage() << endl; K) p5 q4 {" c& `% e( l+ o
cout << "error " << ex.ifail() << endl; & X }' s( V; S# _
}
0 t$ c, @" U, X}[/mw_shl_code]+ }6 [; o' E# i2 d
|
|