|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ ~- O X& L7 vTeamcenter二次开发源码分享:创建信封发送邮件
6 l) p9 R P o% y7 X" J& b6 ~ N k. N7 R6 B1 m
[mw_shl_code=cpp,true]#include <iostream>
2 h8 `) T3 @1 K3 q4 Q( L' w1 c#include <sa/user.h>
, N! a' x2 r* J#include <TC/envelope.h>: B! C- M4 }$ u3 c! v1 x! a
#include <tc/tc.h>( g, t' K3 G- i0 y; ], @; p, b
: Q& d) i1 }6 }7 O#include <base_utils/IFail.hxx>
/ _, ~/ v6 S* V#include <base_utils/TcResultStatus.hxx>/ J( i% e |/ B2 y( m
#include <mld/logging/TcMainLogger.hxx>
5 R$ K, U4 h, [" N1 c& ?, P#include <base_utils/ScopedSmPtr.hxx>5 r: }/ g/ u& O5 d
4 `; J7 U% J/ V& j, q
using namespace std;
$ j+ R, x9 t" ~( Eusing namespace Teamcenter;! I$ D! B9 o+ L3 |, z- w6 V
using Teamcenter::Main::logger;2 x, n) k# Y# f1 B. v6 H( r
$ j O, w9 j: ^static void create_envelope_and_send_mail(void)
c5 X2 ` `% d; I6 U( A{, k7 T, e, v# ?
int ifail = ITK_ok;
6 j( F, o* j! M ResultStatus stat;' P7 f" t$ q$ d
try
) W; o) N; ?5 ~: @$ c# ? {
@( r4 s6 J; j5 c8 h1 A- t scoped_smptr<char> user_name_string;' D6 x: {" k+ b* ?1 C8 ?% H
tag_t user_tag = NULLTAG;4 C: e" n9 d5 C$ b* y) ?
stat = POM_get_user(&user_name_string, &user_tag);( M, `* M( a6 a/ x$ t$ L
% n. n3 {0 s9 `
tag_t envelope = NULLTAG;
8 W1 \7 M! ?9 z# R# m" L3 P stat = MAIL_create_envelope("1234567/A", "1234567/A", &envelope);: B4 f# {3 o2 C& d
3 a5 X' h5 s# U9 |. P3 c stat = MAIL_initialize_envelope(envelope,"1234567/A", "1234567/A");
5 b* H" R5 t& o2 f2 e- s; Z stat = MAIL_add_envelope_receiver(envelope, user_tag);/ }2 `" ?: s) C( h! M0 Q
stat = MAIL_send_envelope(envelope);& e9 H$ g& f" W6 i& o3 u& K
) h' s9 c) k7 K. {( q! D( E tag_t mailbox = NULLTAG;6 \' {2 K e O
stat = SA_ask_user_mailbox(user_tag, &mailbox);
! _" r- P. v+ F- k e }3 u& V2 Z0 M) a- I/ ?( w+ n
catch( const IFail &ex )) W: h4 x0 O* A6 w5 m
{" s; Y* M6 M9 @) D' r+ k
logger()->error( ex.ifail(), ex.getMessage());
7 H8 o% K O" b/ U$ O cout << ex.getMessage() << endl;
8 ^+ H4 @- S/ \/ R2 M; @0 X$ ? cout << "error " << ex.ifail() << endl;
& G: T) i: f! A( q }* f; o! b& o. {7 h9 r {/ Z
}[/mw_shl_code]
0 v2 _+ M' h0 |5 B5 l7 S0 [ |
|