当前位置: 代码迷 >> PB >> 关于PB中发E-MAIL的有关问题
  详细解决方案

关于PB中发E-MAIL的有关问题

热度:288   发布时间:2016-04-29 09:25:50.0
关于PB中发E-MAIL的问题
各位好,小弟想请问一个关于从PB发E-MAIL的问题,先前测试透过ASPMAIL(aspemail.dll)发E-MAIL,不过这个软件似乎要购买的,而且我也只能用30天,所以想透过其它的方式,像是JMAIL或是MYMAIL不过不前不知道该如何改写,尝试了几次都失败了,想请教各位前辈。

目的也很简单,只想按一个按钮就发信,所以只有单纯在cb_1加入以下内容。

最早透过aspemail.dll是这样的:
  oleobject mail
  long rt1
  mail = create oleobject
  mail.reset
  mail.Host = "192.168.0.1"//SMTP server
  mail.From = "[email protected]"//address
  mail.FromName = "USER"//name
  mail.username = "user"//username
  mail.password = "xxxxxx"//password
  mail.AddAddress("[email protected]")
  mail.AddAttachment ("D:\test.txt")
  mail.Charset = "BG2312"
  mail.Subject = "test from PB"
  mail.body = "this is test from PB"
  mail.Send
  mail.disconnectobject()
  messagebox("send","OK!")

感激


------解决方案--------------------
http://download.csdn.net/source/1422097

1、注册jmail.dll 方法:在运行中输入: regsvr32 路径\jmail.dll 
2、示例代码: 
oleobject jmail 
Jmail = Create OLEObject 
Jmail.ConnectToNewObject("JMail.Message") 
Jmail.Charset = ls_charset //中文用 “GB2312” 
Jmail.ISOEncodeHeaders = True 
Jmail.silent = True 
Jmail.Logging = True 
Jmail.From = ls_user //发件人邮箱 
Jmail.FromName = ls_mail_fr //发件人 
Jmail.Subject = ls_subject //邮件主题 
Jmail.MailServerUserName = ls_user //发件邮箱登录账户 
Jmail.MailServerPassword = ls_pwd //发件邮箱用户密码 
Jmail.Priority = 3 //优先级 
Jmail.AddRecipient(ls_mail_to) //收件人邮箱 
Jmail.Body =ls_Text + "~r~n" //邮件内容 

IF Jmail.Send(ls_host) THEN //ls_host为发件邮箱服务器 
messagebox('Info',"发送成功!") 
ELSE 
messagebox('Info',"发送失败!") 
END IF 
Jmail.Close() 
Destroy Jmail
  相关解决方案