delphi 发送html邮件,delphi - Send Email in HTML Format - Stack Overflow

At the moment we are using MAPI to send a plain text email from our application. We specify the dialog flag when the user invokes this function, so that the email will appear in their email client and they can then modify it and send it.

We would like to embelish the email and send it in an HTML format.

According to this link MSDN link MAPI is not sutiable for this http://support.microsoft.com/kb/268440

I have seen an article on ExpertsExchange that say you can use MAPI to do it but I can't get the example to work with Outlook (not tried anyother client yet)

procedure ShowMailDlg(ToName,Address,HTMLMessage: string);

var

li: integer;

lMessage: TMapiMessage;

lRecipArray: array of TMapiRecipDesc;

lREs: DWord;

begin

SetLength(lRecipArray,1);

lRecipArray[0].ulRecipClass:=MAPI_TO;

lRecipArray[0].lpszName:=pChar(ToName);

lRecipArray[0].lpszAddress:=pChar(Address);

lMessage.ulReserved:=0;

lMessage.lpszSubject:=nil;

lMessage.lpszNoteText:=pChar(HTMLMessage);

lMessage.lpszMessageType:= nil;//pChar('HTML');

lMessage.lpszDateReceived:=nil;

lMessage.lpszConversationID:=nil;

lMessage.flFlags:=0;

lMessage.lpOriginator:=nil;

lMessage.nRecipCount:=length(lRecipArray);

lMessage.lpRecips:=PMapiRecipDesc(lRecipArray);

lMessage.nFileCount:=0;

lMessage.lpFiles:=PMapiFileDesc(nil);

lRes:=MapiSendMail(0, 0 , lMessage,MAPI_DIALOG, 0);

end;

Anyone have any ideas how I can do this. I could probably automate Outlook but I would like to keep it fairly independant of email client (hence MAPI)

Thanks

Update: thanks to everyone for the suggestions. The feature is question is not that heavily used, so asking the user to configure SMTP details is not really an option. I think we will just stick to the plain text email.

Thanks

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值