在visual basic 6.0 windows应用程序中发送邮件 [英] send mail in visual basic 6.0 windows application

查看:80
本文介绍了在visual basic 6.0 windows应用程序中发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在visual basic 6.0 windows应用程序中发送邮件

send mail in visual basic 6.0 windows application

推荐答案

Dim mail As New MailMessage()
mail.To = "me@mycompany.com"
mail.From = "you@yourcompany.com"
mail.Subject = "this is a test email."
mail.BodyFormat = MailFormat.Html
mail.Body = "this is my test email body.
this part is in bold"
SmtpMail.SmtpServer = "localhost" 'your real server goes here
SmtpMail.Send(mail)





附件。



With attachment.

Dim mail As New MailMessage()
mail.To = "me@mycompany.com"
mail.From = "you@yourcompany.com"
mail.Subject = "this is a test email."
mail.Body = "this is my test email body."
Dim attachment As New MailAttachment(Server.MapPath("test.txt")) 'create the attachment
mail.Attachments.Add(attachment) 'add the attachment
SmtpMail.SmtpServer = "localhost" 'your real server goes here
SmtpMail.Send(mail)


这不是一个问题。一个问题会有'我想做xxx,我已经尝试了yyy而且我坚持使用zzz'。你的问题是我选择使用一种已经死了10年的语言,但我希望这里有人仍然使用它,因为我需要用它做一些事情而且我懒得自己尝试。



回想起来,你似乎比这更清楚。我假设你在某个地方做有偿工作并做随机任务,接受任何工作,尽管不知道怎么做他们中的任何一个。我一字一句地输入你的问题,进入谷歌并找到了这个 [ ^ ]。你为什么不先尝试?
This is not a question. A question would have things like 'I want to do xxx, I've tried yyy and I'm stuck with zzz'. Your question reads 'I am choosing to use a language that has been dead for 10 years, and yet I hope someone here still uses it because I need to do something with it and I am too lazy to try for myself.

Looking back, you seem to know better than this. I'm assuming you're doing paid work somewhere and doing random tasks, accepting any job, despite having no clue how to do any of them. I typed your question, word for word, in to google and found this[^]. Why could you not try that first ?


使用下面的代码在VB6中发送邮件

Use the below code to send mail in VB6
Dim mail As New MailMessage()
mail.To = "tomailid@mailer.com"
mail.From = "frommailid@mailer.com"
mail.Subject = "Enter any subject here."
mail.BodyFormat = MailFormat.Html
mail.Body = "Mail body here"
SmtpMail.SmtpServer = "localhost" ‘smtp server details
SmtpMail.Send(mail)



请参阅这个链接用于发送带附件的邮件


Refer this link for sending mail with attachment


这篇关于在visual basic 6.0 windows应用程序中发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆