Click here to Skip to main content
15,890,609 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
send mail in visual basic 6.0 windows application
Posted
Updated 15-May-16 23:40pm
Comments
Member 10372349 1-Nov-13 6:50am    
How to Send Bulk SMS from VB6 Application

VB
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.
VB
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)
 
Share this answer
 
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 ?
 
Share this answer
 
Use the below code to send mail in VB6
VB
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
 
Share this answer
 
Comments
[no name] 16-May-16 5:42am    
where is the mail password?
Richard MacCutchan 19-May-16 12:43pm    
Why are you posting this in a question that is almost 4 years old?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900