CodeDocu.com

 

 

 

If you want to send emails directly from a Microsoft Office application, then you must go back to an email sending client.

As a rule, Outlook is used as a remote object.

This example uses a .NET client that directly sends the emails without using Outlook.

 

 

In the example, a form is given, which has the fields FROM, TO as email address input. In addition, you need the address of the email server or the domain, via which you want to send the emails.

In combination with the password, the entered message can then be sent as subject and text.

MS Office Access: Sending emails directly from the Office application without Outlook

 

In the code-behind page, a SMTP send control is integrated as a control under Menu-> Extras-> References.

The control is attached in the appendix to the download.

MS Office Access: Sending emails directly from the Office application without Outlook

 

You only have to add a reference to the file: Office_Email_Send.tlb under the Office application.

Here is Microsoft MSAccess.

MS Office Access: Sending emails directly from the Office application without Outlook

 

 

Refer to the included .tlb file for reference. This includes the code for a simple .NET 4 Email SendClient.

MS Office Access: Sending emails directly from the Office application without Outlook

 

 

At run time

MS Office Access: Sending emails directly from the Office application without Outlook

 

 

In the example, the result is returned with True after successful transmission

MS Office Access: Sending emails directly from the Office application without Outlook

 

Option Compare Database

Option Explicit On

 

Private Sub btnSend_Click()

    '---------------< btnSend_Click() >----------------

    '< variables >

    Dim TO_Email As String

    Dim FROM_Email As String

    Dim Password As String

    Dim SMTP_Domain As String

    Dim Subject_Title As String

    Dim Text_Body As String

    '</ variables >

 

    '< init >

    TO_Email = tbxEmail_To

    FROM_Email = tbxEmail_From

    Password = tbxPassword

    SMTP_Domain = tbxDomain

    Subject_Title = tbx_Subject

    Text_Body = Text_Body

    '</ init >

 

 

    '----< Send Email >----

 

    Dim objEmail_Sender As New Office_Email_Send.Email_Sender

    Dim IsSend As Boolean

 

    '< Send >

    IsSend = objEmail_Sender.Send_Email(TO_Email, "", FROM_Email, Password, SMTP_Domain, Subject_Title, Text_Body)

    '< Send >

 

    MsgBox "Result Email send is: ", vbInformation, "COM Result" & IsSend

    '----</ Send Email >----

 

 

    '---------------</ btnSend_Click() >----------------

End Sub

 

 

 

keywords:

MSAccess, Access, Excel Word, Office

Email Client EmailClient SMTP MailClient SMTPClient COM Control ActiveX 


Software Entwicklung Stuttgart NĂ¼rtingen
Suche Projekte C#, WPF, Windows App,ASP.Net, vb.Net, WinForms, SQL Server, Access, Excel