20#include <com/sun/star/lang/XComponent.hpp>
21#include <com/sun/star/registry/XSimpleRegistry.hpp>
22#include <com/sun/star/system/XSimpleMailClientSupplier.hpp>
23#include <cppuhelper/servicefactory.hxx>
24#include <rtl/ustring.hxx>
26#include <osl/diagnose.h>
32#include <osl/file.hxx>
38using namespace ::
cppu ;
42using namespace com::sun::star::system;
44#define RDB_SYSPATH "D:\\Projects\\gsl\\shell\\wntmsci7\\bin\\applicat.rdb"
58int SAL_CALL
main(
int ,
char*,
char* )
71 OSL_FAIL(
"Can't create RegistryServiceFactory");
75 printf(
"Creating RegistryServiceFactory successful\n");
83 Reference< XSimpleMailClientSupplier > xSmplMailClientSuppl(
84 g_xFactory->createInstance(
"com.sun.star.system.SimpleSystemMail"), UNO_QUERY );
86 if ( !xSmplMailClientSuppl.is() )
88 OSL_FAIL(
"Error creating SimpleSystemMail Service" );
92 Reference< XSimpleMailClient > xSmplMailClient(
93 xSmplMailClientSuppl->querySimpleMailClient( ) );
95 if ( xSmplMailClient.is( ) )
97 Reference< XSimpleMailMessage > xSmplMailMsg(
98 xSmplMailClient->createSimpleMailMessage( ) );
100 if ( xSmplMailMsg.is( ) )
102 xSmplMailMsg->setRecipient( OUString(
"tino.rachui@germany.sun.com") );
103 xSmplMailMsg->setOriginator( OUString(
"tino.rachui@germany.sun.com") );
105 Sequence<OUString> ccRecips {
"tino.rachui@germany.sun.com" };
107 xSmplMailMsg->setCcRecipient( ccRecips );
109 Sequence<OUString> bccRecips {
"tino.rachui@germany.sun.com" };
111 xSmplMailMsg->setBccRecipient( bccRecips );
113 xSmplMailMsg->setSubject( OUString(
"Mapi Test") );
115 Sequence< OUString > attachments( 2 );
117 OUString aFile(
"D:\\Projects\\gsl\\shell\\wntmsci7\\bin\\testprx.exe");
120 osl::FileBase::getFileURLFromSystemPath( aFile, aFileURL );
121 attachments[0] = aFileURL;
123 aFile =
"D:\\Projects\\gsl\\shell\\wntmsci7\\bin\\testsyssh.exe";
124 osl::FileBase::getFileURLFromSystemPath( aFile, aFileURL );
126 attachments[1] = aFile;
128 xSmplMailMsg->setAttachement( attachments );
130 xSmplMailClient->sendSimpleMailMessage( xSmplMailMsg, 0 );
143 Reference< XComponent > xComponent(
g_xFactory, UNO_QUERY );
148 OSL_FAIL(
"Error shutting down");
152 xComponent->dispose();
155 printf(
"Test successful\n");
Reference< XMultiServiceFactory > g_xFactory
int SAL_CALL main(int, char *, char *)
SAL_DLLPUBLIC_EXPORT css::uno::Reference< css::lang::XMultiServiceFactory > SAL_CALL createRegistryServiceFactory(OUString const &, OUString const &, sal_Bool, OUString const &)