|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- s5 W& P; s$ B1 l
Teamcenter二次开发源码分享:创建信封发送邮件/ M. X& ^: o6 U4 x6 Y
9 h H9 u; r4 M ?( }: C- }[mw_shl_code=cpp,true]#include <iostream>
; F* O# J) m+ E4 O#include <sa/user.h>
4 N. y# }9 C7 \! ^2 j#include <TC/envelope.h>4 t/ p5 r, ]+ ?
#include <tc/tc.h>
w% n) H z$ c0 ^- ^! U. @/ C9 U6 u% o/ R! S7 U0 S; F
#include <base_utils/IFail.hxx>
( k; B |1 Z$ F. T. D" ]2 k#include <base_utils/TcResultStatus.hxx>! `# J0 }: H& a9 b$ a" r$ X/ X
#include <mld/logging/TcMainLogger.hxx>! w6 a! E/ J ?* ]9 E7 W
#include <base_utils/ScopedSmPtr.hxx>
$ l8 O% a7 b& r# ~6 r' X) e9 h
3 [# L. Q( C: L" Y- f( qusing namespace std;, M2 `( P" ~: y' C" F' |
using namespace Teamcenter;
8 k1 ]6 @9 K$ L$ L2 N* @- Rusing Teamcenter::Main::logger;) T8 {4 E1 E3 G( J( S
- r' q* l9 o( _! H, g1 `3 @. F$ xstatic void create_envelope_and_send_mail(void)0 {2 N) Y, T/ z: H
{
5 q% A0 l: G, V: m) A; G+ S int ifail = ITK_ok;
& z0 Y2 q: r, V/ L ResultStatus stat;
9 |% g c, q |. L try, n/ i y0 Y/ f; z1 R' c
{
4 @5 G( ]) k/ u8 s! D scoped_smptr<char> user_name_string;
5 j, [6 ~2 E: s3 l! A" d+ a tag_t user_tag = NULLTAG;
' y0 R3 f2 T* o1 W9 r stat = POM_get_user(&user_name_string, &user_tag);" E( ]7 {- Y" v* @! W1 A) ?6 Z
! I: d* a0 s! |4 `: I3 s& j! z tag_t envelope = NULLTAG;
0 z: ^6 o% ? L7 \- l( ?0 B" U6 F stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
1 P" s0 ^3 t7 X ' y8 p4 I* e! a( k
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");. j0 W3 M, f' F0 j
stat = MAIL_add_envelope_receiver(envelope, user_tag);
" L: n+ C5 N) ]3 u O& A stat = MAIL_send_envelope(envelope);
( C2 a9 t K) i; H! F, h# y" \- \! L( o" N2 S6 W; D+ _
tag_t mailbox = NULLTAG;
. a. L3 Y7 d {1 F7 E* J$ ~ stat = SA_ask_user_mailbox(user_tag, &mailbox);
; t+ Y- P9 G k }9 H4 [1 Q" z& H- g) b4 R# h( k( B
catch( const IFail &ex )) `$ J2 b" D8 E9 }3 ?8 ^
{
( a) j9 C& N5 |/ y logger()->error( ex.ifail(), ex.getMessage());
C. W0 `% ^' a& w1 f cout << ex.getMessage() << endl;5 E3 {' q% y4 I2 S
cout << "error " << ex.ifail() << endl;
- ~! n6 u; ]+ a* F }8 b4 W) n& }# L: q4 @( d! b R
}[/mw_shl_code]
) U* I2 U j1 o2 @ |
|