Delphi6利用WebService 编写 SendEMail程序 (转)

本文介绍如何使用Delphi6结合WebService实现发送电子邮件的功能。通过下载并配置特定的程序接口,用户可以在Delphi环境中轻松调用发送邮件的服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Delphi6利用WebService 编写 SendEMail程序 (转)[@more@]microsoft FrontPage 5.0">

 到http://www.xmethods.com

就会看到一个Delphi做的服务器程序. Send an EMail

 


3.jpg

 

有如下描述:

4.jpg

我们下载程序接口:

点WSDL URL连接

8.jpg

另存为名为IemailService.wsdl到你的程序相同目录.

9.jpg

导入程序接口:

2.jpg

5.jpg

然后会生成Unit2单元.

Unit Unit2;

interface

uses Types, XSBuiltIns;
type

  IEmailService = interface(IInvokable)
  ['{839561db-8AFE-43B8-81EB-5505C873EC8F}']
  function sendmail(const ToAddress: WideString; const FromAddress: WideString; const ASubject: WideString; const MsgBody: WideString): Integer;  stdcall;
  end;


implementation

uses InvokeRegistry;

initialization
  InvRegistry.RegisterInterface(TypeInfo(IEmailService), '', '');

end.

 

 

6.jpg

选择刚才保存的wsdl文件给HTTPRIO1.WSDLLaction属性

7.jpg

在Unit1中运行编程

unit Unit1;

interface

uses
  windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,  Rio, SOApHTTPClient, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
  Button1: TButton;
  HTTPRIO1: THTTPRIO;
  LabeledEdit1: TLabeledEdit;
  LabeledEdit2: TLabeledEdit;
  LabeledEdit3: TLabeledEdit;
  Memo1: TMemo;
  procedure Button1Click(Sender: Tobject);
  private
  { Private declarations }
  public
  { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;  /////////////

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  if (HTTPRIO1 as IEmailService).SendMail
  (LabeledEdit1.Text,
  LabeledEdit2.Text,
  LabeledEdit3.Text,
  Memo1.Text
  ) = 0 then
  ShowMessage('Send Success!');
end;

end.

可以发邮件了,很方便也很简单.


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-990270/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10752043/viewspace-990270/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值