Loading...


bookmark - How To Send Email Using VB (using SMTP) ? best way to send email in vb

How To Send Email Using VB (using SMTP) ? - best way to send email in vb

 
 Discussion by connectpal with 16 Replies.
 Last Update: June 13, 2011, 5:45 am ( View Rated (6) )
 
bookmark - How To Send Email Using VB (using SMTP) ? best way to send email in vb  
Quickly Post to How To Send Email Using VB (using SMTP) ? best way to send email in vb w/o signup Share Info about How To Send Email Using VB (using SMTP) ? best way to send email in vb using Facebook, Twitter etc. email your friend about How To Send Email Using VB (using SMTP) ? best way to send email in vb Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Hi everybody,

I want to send an email to multi users through my VB application.
I don't know if I can use a VB class for this case or I should download a smtp mail component.
I would be thankful if you can suggest me the best solution.
Please give me a code example for former solution or introduce me an effective free, permanent component.









   Sun May 22, 2005    Reply         

I , myself, am not sure about this. My friend says it can be done purely through VB. I will find out more about this from her. I have doubts about your legal purposes of this program you are going to make, but oh well, it's your choice.

   Sun May 22, 2005    Reply         

I'm not a huge fan of Visual Basic, but controlling an SMTP server isn't all that hard. Basically, all you need to do is connect to it, specify the sender and receipient(s), and send the message.

And also, you might want to consider posting this in the Visual Basic forum.

   Sat May 28, 2005    Reply         


Using winsock is enough.

But you do need a SMTP server where you have a account from, like the smtp server of your isp since relaying is disabled in 99 out of 100 servers these days :D

I did create a small basic smtp email proggie though, if you need the VB source i might even mail it to you if you ask nicely :D









   Sat May 28, 2005    Reply         

You can use the Microsoft Webbrowser control in there and use PHP :lol:

   Wed Jun 29, 2005    Reply         

I can provide you a solution using VB.NET - I can't stand VB6 anymore..

The .NET framework provides you with a class called SmtpMail - which under normal circumstances isn't available for use with Windows forms. It's meant for ASP.NET applications and can be found in the library System.Web.Mail namespace. All you've to do to make it work in your WinForm application is include a Reference to the file, System.Web.dll. This can be done by right-clicking on References in your Project explorer and clicking Add reference.

Once you've added this, use the following code to send mails out:

CODE

Imports System;
Imports System.Web.Mail;

Dim EmailTo As String     'Emailaddres for user to send
Dim EmailFrom As String   'Emailaddres for user from
Dim MailSubject As String 'Subject of Mail
Dim MessageBody As String 'Message
Dim ServerName As String  'Server Name - important


ServerName = "<<Your SMTP server's Name>>"
'Similarly, add in EmailTo, EmailFrom etc parameters here
EmailTo = "someone@recipient.net"
EmailFrom = "me@mysqlf.net"
...
.....


'Set the SMTP Server's address
SmtpMail.SmtpServer = ServerName


'This is the code that sends out the email based on whatever server information you've set
'Enclosed within Try-Catch block to catch exceptions in case of errors
Try
SmtpMail.Send (EmailFrom, EmailTo, MailSubject, MessageBody)
Catch ex As Exception
   MsgBox ( "Delivery Failure: " & ex.Source & ex.Message )
End Try


Hope this helps...
Regards,
m^e

   Wed Jun 29, 2005    Reply         


coding in email
How To Send Email Using VB (using SMTP) ?

I have to simple coding in email sending.I have use To,From,Subject, Message and Submit Button...When I send mail it will be store in my computer..I have use ASP.net with VB,VB.NET.

-reply by chitar bahadur

   Tue Mar 18, 2008    Reply         

Replying to Feedbacker
Sub SendMail()
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.Microsoft.Com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.Microsoft.Com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.Microsoft.Com/cdo/configuration/sendusername") = "yourmail@gmail.Com"
.Item("http://schemas.Microsoft.Com/cdo/configuration/sendpassword") = "yourpassword"
.Item("http://schemas.Microsoft.Com/cdo/configuration/smtpserver") = "smtp.Gmail.Com"
.Item("http://schemas.Microsoft.Com/cdo/configuration/sendusing") = 2
.Item("http://schemas.Microsoft.Com/cdo/configuration/smtpserverport") = 25
.Update
End With

strbody = "Sample message " & Time

With iMsg
Set .Configuration = iConf
.To = sendto
.CC = ""
.BCC = ""
' Note: The reply address is not working if you use this Gmail example
' It will use your Gmail address automatic. But you can add this line
' to change the reply address .ReplyTo = "Reply@something.Com"
.From = "<mail to be displayed as @gmail.Com>"
.Subject = "subject"
.TextBody = strbody
.Send
End With

End Sub

-reply by shasunder

   Fri May 23, 2008    Reply         

is it possible using MAPIMessages.
How To Send Email Using VB (using SMTP) ?

Hi All,



Is it possible to send mail with CC and BCC using MAPIMessages ?



Thanks in advance.



RK.

   Thu Jun 19, 2008    Reply         

Dim iMsg As Object Dim iConf As Object Dim Flds As Variant Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") iConf.Load -1 ' CDO Source Defaults Set Flds = iConf.Fields With Flds .Item("http://schemas.Microsoft.Com/cdo/configuration/smtpusessl") = True .Item("http://schemas.Microsoft.Com/cdo/configuration/smtpauthenticate") = 1 .Item("http://schemas.Microsoft.Com/cdo/configuration/sendusername") = "yourmail@gmail.Com" .Item("http://schemas.Microsoft.Com/cdo/configuration/sendpassword") = "yourpassword" .Item("http://schemas.Microsoft.Com/cdo/configuration/smtpserver") = "smtp.Gmail.Com" .Item("http://schemas.Microsoft.Com/cdo/configuration/sendusing") = 2 .Item("http://schemas.Microsoft.Com/cdo/configuration/smtpserverport") = 25 .Update End With strbody = "Sample message " & Time With iMsg Set .Configuration = iConf .To = sendto .CC = "" .BCC = "" ' Note: The reply address is not working if you use this Gmail example ' It will use your Gmail address automatic. But you can add this line ' to change the reply address .ReplyTo = "Reply@something.Com" .From = "<mail to be displayed as @gmail.Com>" .Subject = "subject" .TextBody = strbody .Send End With

THEREis a error in the ".Send"

whatcan it be??

-reply by JOAO

   Sat Aug 22, 2009    Reply         

kode vb6 bla-blaHow To Send Email Using VB (using SMTP) ?

Coba cara saya ini, tapi maaf saya kurang tau bahasa inggris jadi kamuterjemahkan aja ya ?

Private Sub AEMAIL()Set objEmail = CreateObject("CDO.Message")ObjEmail.From = "zanggi@yahoo.Com" 'bisa pakai sembarang email, tak masalah

   ObjEmail.To = "romawu@yahoo.Co.Id"ObjEmail.CC = " "ObjEmail.BCC = " "ObjEmail.Subject = "indonesia"    ObjEmail.TextBody = "Isi pesan yang akan disampaikan"  'untuk kirim file'objEmail.AddAttachment "C:ScriptsOutput.Txt" 'jika kamu mau mengirim file"

 ObjEmail.Configuration.Fields.Item _("http://schemas.Microsoft.Com/cdo/configuration/Sendusing") = 2ObjEmail.Configuration.Fields.Item _("http://schemas.Microsoft.Com/cdo/configuration/smtpserver") = "125.160.6.252" 'ping dari server yang dapat dilihat dari commanfrom, dengan mengetikkan "ping smtp.Telkom.Net" ,jika kamu pakai speedy

objEmail.Configuration.Fields.Item _("http://schemas.Microsoft.Com/cdo/configuration/smtpserverport") = 25ObjEmail.Configuration.Fields.UpdateObjEmail.SendEnd Sub

-reply by k.Nizam, S.Kom

 

   Wed Feb 10, 2010    Reply         

mailing code not work on serverHow To Send Email Using VB (using SMTP) ?I already used this code and it run very well on my pc but when I upload html page which having mailing vb script code, on server it didnt give any responce means mail is not send to mentioned email id.Pls give me solution for that I tryed it lot but no proper solution.-question by ranjeet

   Fri Mar 19, 2010    Reply         

code executed but no mailsHow To Send Email Using VB (using SMTP) ?Replying to miCRoSCoPiC^eaRthLinGHi, I used your above code with ssl encryption. Code executed successfully but I didn't receive any mails to the mail id used in my code so far.Pl help me to solve this. Its urgent...Thanks in advance-question by sree

 

   Fri Jul 23, 2010    Reply         

Sending email from gmail - how to send mail from gmail using vb6How To Send Email Using VB (using SMTP) ?

Hi,

Is there any way to send mail from gmail using SMSP.

I used the code which u have provided but not able to send the mail.

getting error message as  

run time error

the transport failed to connect to the server.

please help me out

 

Thanks

   Wed Jun 9, 2010    Reply         

how to over come "The transport failed to connect to the server."How To Send Email Using VB (using SMTP) ?

using CDO objects I have got this message

The transport failed to connect to the server.

can any one help me against this problem

-reply by Farrukh jamal

 

   Mon Sep 27, 2010    Reply         

sender address rejectedHow To Send Email Using VB (using SMTP) ?

I used a gmail address and got an error message as bellow:Error from Functions.SendEmail:The server rejected the sender address. The server response was: 530 5.7.0 Must issue a STARTTLS command first. F20sm1621609wfl.21Please help!!Thanks.

-question by kunthet

   Mon Aug 8, 2011    Reply         

using one command botton i have to send mailHow To Send Email Using VB (using SMTP) ?Help.I have to make a list box . Then a command box . I choose a name from list box then click on command box mail will go to that name with attachment from a file. 
 
 -reply by gyan

   Mon Jun 13, 2011    Reply         

Quickly Post to How To Send Email Using VB (using SMTP) ? best way to send email in vb w/o signup Share Info about How To Send Email Using VB (using SMTP) ? best way to send email in vb using Facebook, Twitter etc. email your friend about How To Send Email Using VB (using SMTP) ? best way to send email in vb Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

Php Send Email Problem

I have a problem with send e-mail form! First it was designed only for name,email,subject and message entries! Now I need to add organisation and phone to be sent to my email! When I click the send button, it gives me that "mail" suposed to have 5 variables, a ...more

   19-Jan-2005    Reply         

Php Send Mail Through Smtp

Can anyone here tell me how to send mail through SMTP server with php I have search in many source code on web and cant find anything ...more

   04-Oct-2006    Reply         

Php Send Mail Through Phpmailer

Can anyone here please tell me how to send mail through PHPMailer in php I have search in many source code on web and cant find anything...please he ...more

   17-Dec-2009    Reply         

VB.NET: Howto Add And Delete Files Just looking for useful code   VB.NET: Howto Add And Delete Files Just looking for useful code (11) (3) Manipulating Excel File With VB? opening and doing data stuff in vb  Manipulating Excel File With VB? opening and doing data stuff in vb