Go Back   Access World Forums > Apps and Windows > VB.NET

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 03-12-2019, 11:45 PM   #1
bjsteyn
Newly Registered User
 
Join Date: May 2008
Posts: 111
Thanks: 1
Thanked 9 Times in 9 Posts
bjsteyn is on a distinguished road
How do i send a TLS mail using VB.net (Need an free easendmail alternative)

Hi i was using easendmail to send mail using TLS until the trial i didn't know about expired, is there any free method in VB.net or external dll i can use to send mail using TLS protorcols.

bjsteyn is offline   Reply With Quote
Old 03-13-2019, 12:16 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,319
Thanks: 0
Thanked 728 Times in 713 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: How do i send a TLS mail using VB.net (Need an free easendmail alternative)

try SENDOBJECT,(in access)
docmd.SendObject acSendReport ,"rMyReport",acFormatPDF,sTo,,,sSubj,sBody
docmd.SendObject acSendQuery ,"qsMyQuery",acFormatXLS,sTo,,,sSubj,sBody

OR usu there is a .dll or .ocx installed for every app.
Enter VBE, Alt-F11,
menu, tools, references
check mark TLS mail, (or similar object library)

then use the code below, but replace OUTLOOK objects with your TLS.
It may or may not work.

usage:
call Email1(sTo, sSubj, sBody)

Code:
Public Function Email1(ByVal pvTo, ByVal pvSubj, ByVal pvBody, Optional ByVal pvFile) As Boolean
Dim oApp As Outlook.Application
Dim oMail As Outlook.MailItem

On Error GoTo ErrMail

'NOTE : YOU MUST HAVE THE OUTLOOK REFERENCE CHECKED IN VBE; ctl-G, menu,tools, references, Microsoft Outlook XX Object library
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.createitem(olMailItem)

With oMail
    .To = pvTo
    .Subject = pvSubj
    If Not IsNull(pvBody) Then .Body = pvBody
    If Not IsMissing(pvFile) Then .Attachments.Add pvFile, olByValue, 1
    
    '.Display True    
    '.Save    'draft, we are NOT sending...we save as draft
    .Send     
    
End With

Email1 = True
endit:
Set oMail = Nothing
Set oApp = Nothing
Exit Function

ErrMail:
MsgBox Err.Description, vbCritical, Err
Resume endit
End Function
Ranman256 is offline   Reply With Quote
Old 03-13-2019, 02:23 AM   #3
sonic8
Newly Registered User
 
Join Date: Oct 2015
Posts: 188
Thanks: 31
Thanked 52 Times in 50 Posts
sonic8 is on a distinguished road
Re: How do i send a TLS mail using VB.net (Need an free easendmail alternative)

Quote:
Originally Posted by bjsteyn View Post
... is there any free method in VB.net or external dll i can use to send mail using TLS protorcols.

Yes, it's built into the .Net Framework.


First, you should find out what protocol(s) your provider supports.


The recommend namespace for email is System.Net.Mail. However, as far as I know, this supports only explicit SSL/TLS with the STARTTLS command.
This might have changed with .Net 4.6 and later because there where many SSL/TLS enhancements included.


You could also use System.Web.Mail. This namespace supports implicit and explicit SSL/TLS. However, it is marked as deprecated but still work in all current versions of .Net Framework.


In any case, I would suggest you wrap your email code in a custom abstraction layer to easily change it later if requirements, availability and/or capabilities of the used email component change.

__________________
New article:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
sonic8 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Word Mail Merge Manager, Alternative to Alber Kallal's system GiPSyFiSH Modules & VBA 0 07-16-2013 02:23 AM
Bulk Mail send with different mail body contents akashneelh General 2 04-27-2013 06:34 AM
alternative to MAIL() ajetrumpet PHP & MySQL 4 06-28-2011 02:40 AM
[SOLVED] Send mail McGowan General 0 06-27-2006 10:33 AM
Send to mail? Nirious General 2 01-24-2005 07:26 AM




All times are GMT -8. The time now is 04:43 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World