|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 _; u/ M: a2 d5 G$ j4 E9 ~) w
Teamcenter二次开发源码分享:创建信封发送邮件
* n h* k6 S0 U( m: n" @8 P
v7 b. q' `- O, |% L[mw_shl_code=cpp,true]#include <iostream>
2 }/ u! }5 \! j& g% K5 ~/ Y9 `6 C( m#include <sa/user.h>$ b$ T" C+ m: o# H; N
#include <TC/envelope.h>
5 W9 K) E6 j5 z1 X#include <tc/tc.h>4 ?5 u9 B, J& C. Z
' y4 z% G: Y" e9 V9 y2 `$ c
#include <base_utils/IFail.hxx>
8 U" P1 N" Q) r7 h o#include <base_utils/TcResultStatus.hxx>: a, |8 E X3 ?( `7 p# i
#include <mld/logging/TcMainLogger.hxx>; B/ f: @6 z# K& I0 u u
#include <base_utils/ScopedSmPtr.hxx>
$ W p5 t! E1 L: K D" r
3 c h& A' i: [9 `6 F( ?6 j Ousing namespace std;/ j0 [, a: Z+ }
using namespace Teamcenter;
# Z+ e- k9 J3 @9 z [# @using Teamcenter::Main::logger;# p- s, | h+ a8 E3 g
) @0 D" I1 ]7 _* p( Ostatic void create_envelope_and_send_mail(void)" n$ k ^5 N% o( _
{
0 F! Q! J3 o& T; I9 H5 w/ r* q4 }5 t; Y int ifail = ITK_ok;
0 G0 _4 T- W$ c6 j ResultStatus stat;7 `1 _' c' Q: s* R* B/ f0 e" S. f: `
try1 ?9 {2 t- U/ i4 h4 |
{
) k; v! G1 A# V scoped_smptr<char> user_name_string;
0 K! i2 ~/ `6 [5 P tag_t user_tag = NULLTAG;& I$ n2 i0 U! v8 N6 U/ @8 S* u7 k* j2 e
stat = POM_get_user(&user_name_string, &user_tag);& y3 x+ T0 b; ]6 v& x1 E; J0 d* t
5 Z2 U! o/ `0 ]7 O
tag_t envelope = NULLTAG;
4 U$ d3 x2 j2 u b stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);
# }+ N! J" o! W+ l ( [7 g# I4 C3 G+ M
stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");
! s6 S6 A5 w( z* t/ D7 ^8 D# M- r stat = MAIL_add_envelope_receiver(envelope, user_tag);. P K% J& ~: X% c
stat = MAIL_send_envelope(envelope);
- y# X2 a9 {7 O. |. h4 ^
! s# s' y7 a5 g6 B tag_t mailbox = NULLTAG;
- d9 T/ N- N# N. r4 z- P- b7 E- @$ E stat = SA_ask_user_mailbox(user_tag, &mailbox);+ U9 {# l& U' G4 I0 w
}, x9 ^- K5 O" e M+ _# k; T$ E
catch( const IFail &ex )2 ]2 z1 \. w6 n1 w2 a/ a
{
: ^) ~" s% J. y logger()->error( ex.ifail(), ex.getMessage());
. T- ]1 O$ _6 E; w cout << ex.getMessage() << endl;
/ \, x; T! U0 k3 j2 x1 {" i cout << "error " << ex.ifail() << endl;
( ]2 i9 M# }( K$ W i }' {( u) x! J! e: n7 E3 T
}[/mw_shl_code]
. P, t5 T. T# U+ M |
|