I need to be able to have users click on a form field that is an email address to contact the "contact" - it is proving more complicated than I thought. ANY Suggestions will be welcome.:eek:

Recommended Answers

These days the CDO.Message object is more up to date. I had to switch over from CDONTS a while back.

This function was written for VBScript, you will have to set your SMTP server and obviously the BCC is optional

Public Sub emfSendEmail(byval pstrMailTo, _
                        byval …
Jump to Post

All 3 Replies

I need to be able to have users click on a form field that is an email address to contact the "contact" - it is proving more complicated than I thought. ANY Suggestions will be welcome.:eek:

I think that you dont' need Ms Access for send mail via form. You can use for example CDONTS. Your server need to have suppot for CDONTS.

These days the CDO.Message object is more up to date. I had to switch over from CDONTS a while back.

This function was written for VBScript, you will have to set your SMTP server and obviously the BCC is optional

Public Sub emfSendEmail(byval pstrMailTo, _
                        byval pstrSubject, _
                        byval pstrMsg, _
                        byval pstrFromMail)

    Dim objMsg, strSMTP, blnReturn

    blnReturn = false

    Const cdoSendUsingPort = 2

    strSMTP = "someservername.domain.com"

    Set objMsg = CreateObject("CDO.Message")

    'Apply the settings to the message object
    With objMsg

        .From = pstrFromMail
        .To = pstrMailTo
        .BCC = "your email for testing"
        .Subject = pstrSubject
        .TextBody = pstrMsg

        .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        'Name or IP of remote SMTP server
        .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTP
        'Server port
        '.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Configuration.Fields.Update

        On Error Resume Next

        .Send

        If Err.Number = 0 Then
            blnReturn = True
        Else
            response.write "(" & Hex(Err.Number) & ") " & Err.Description
        End If

        On Error Goto 0

    End With

    Set objMsg = Nothing

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.