[AccessD] Email using SMTP

Steve Conklin developer at ultradnt.com
Mon Jan 30 13:24:03 CST 2006


Barbara: 
You can use CDO objects, with late-binding, to do email "component-free":
Hth,
Steve

'=================== Code:
Private Sub Command14_Click()
Dim objmessage
Set objmessage = CreateObject("CDO.Message")
objmessage.Subject = Me.txbSubj ' "Example CDO Message"
objmessage.From = "user at server.net"

objmessage.TextBody = Me.txbMsg ' "This is some sample message text."
'==This section provides the configuration information for the remote SMTP
server.
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mail.server.net"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 '
cdoBasic

'Your UserID on the SMTP server
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "user"

'Your password on the SMTP server
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

'Server port (typically 25)
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

'Use SSL for the connection (False or True)
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

'Connection Timeout in seconds (the maximum time CDO will try to establish a
connection to the SMTP server)
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") =
60

objmessage.To = "someone at somewhere.com"
objmessage.Configuration.Fields.Update
objmessage.Send

End Sub



-----Original Message-----
From: Barbara Ryan [mailto:BarbaraRyan at cox.net]
Sent: Monday, January 30, 2006 11:56 AM
To: Access List
Subject: [AccessD] Email using SMTP


I've found some SMTP components on the web that allow you to email directly
from Access using SMTP.

Does anyone know of any VBA code (e.g., using SMTP "commands") that I could
use WITHOUT using a component (as well as NOT using any electronic mail
application)

Thanks,
Barb Ryan
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list