使用RSendAs发送电子邮件
文章信息
详细描述
使用下列代码发送电子邮件:
头文件:
#include <rsendas.h>
#include <rsendasmessage.h>
#include <senduiconsts.h>
需要的链接库:
LIBRARY sendas2.lib源文件:
RSendAs send;
User::LeaveIfError(send.Connect());
CleanupClosePushL(send);
RSendAsMessage sendAsMessage;
sendAsMessage.CreateL(send, KUidMsgTypeSMTP);
CleanupClosePushL(sendAsMessage);
sendAsMessage.SetSubjectL(_L("Welcome back to symbian"));
sendAsMessage.AddRecipientL(
_L("you@me.com"),SendAsMessage::ESendAsRecipientTo);
//adding to field
sendAsMessage.SetBodyTextL(_L("somebody@world.com"));
TRequestStatus status;
//adding attachments
sendAsMessage.AddAttachment(_L("c:\\splash.bmp"),status);
User::WaitForRequest(status);
sendAsMessage.SendMessageAndCloseL();
CleanupStack::Pop();
CleanupStack::PopAndDestroy();


(no comments yet)