Delphi6利用WebService 编写 SendEMail程序
就会看到一个Delphi做的服务器程序. Send an EMail
有如下描述:
我们下载程序接口:
点WSDL URL连接
另存为名为IEmailService.wsdl到你的程序相同目录.
导入程序接口:
然后会生成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.
选择刚才保存的wsdl文件给HTTPRIO1.WSDLLaction属性
在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.
可以发邮件了,很方便也很简单.
- 点赞
- 收藏
- 分享
- 文章举报
- delphi 中分隔符分隔的字符串
- Delphi快速从文件流读取数据存入本地txt
- Delphi Opendialog用法
- Delphi选择指定路径作为操作路径
- [转]Delphi 12种大小写转换的方法
- 如何给ActiveX数字签名(Step by Step, Delphi)
- Delphi还是那个Delphi,变化了的只是世界
- 再执牛耳,Delphi的安卓开发,效率与性能兼而有之,比之鱼与熊掌
- Delphi的资料和教程,多多的
- delphi中TreeView使用常见问题
- 用delphi写下载程序
- delphi技巧--分离汉字和英文字母
- delphi中var关键字
- Delphi和C++ Builder中的Hibernate开发(一)
- Delphi和C++ Builder中的Hibernate开发(六)
- 关于C#下写的Web Service 服务在Delphi下调用时的问题
- 简单工厂之Delphi实现
- Delphi 对对碰外挂 记录
- delphi TWebBrowser 详细解释
- 禁止 Delphi2010 检测新版本