Emailing without user sending

mkern21

New member
Local time
Today, 18:37
Joined
Mar 30, 2011
Messages
4
I am using Access 2003 and wehave Lotus Notes for emails. I cannot get access to send an email message without the user having to click the send button on the email in Lotus notes. Is it possibel to automatically send an email without user interface?

I ahve a form for incident reporting and i want an email to go out to certain people each time a new incident is added, but I don't want the user to know or have to send the message i just want access to do it automatically is this possible?

I tried the sendobject, but even if i select No to send the object without editing it still pops up the email message and the user has to click send.

Any Suggestions??
Michelle
 
Hi

I'm not familiar with Lotus but I'll guess that it supports vba hence your post. If you post your code and list any references, you would get more help.

You can automatically send emails with vba. You can also use a smtp option which doesn't even need an email platform.

Post your code and I'll respond


Nigel
 
Try searching for a very helpful module called prcSendMail or just SendMail. I don't know who to give credit to here but this little procedure is a must for sending mail that is tranparent to the user if you want to use your company's SMTP mail server relay. It's been a god send for me !!!!
Good luck!!
 
The code I use is the simple sendObject command

DoCmd.SendObject , "", "", "username", "", "", "", "There is a new incident to review", False, ""

It will open a new email message in Lotus Notes with the text in the body of the email, but the user will still have to click send. And I am not sure they give us direct acces to the SMTP servers here. Is that the only way to bypass this?
 
The code I use is the simple sendObject command

DoCmd.SendObject , "", "", "username", "", "", "", "There is a new incident to review", False, ""

It will open a new email message in Lotus Notes with the text in the body of the email, but the user will still have to click send. And I am not sure they give us direct acces to the SMTP servers here. Is that the only way to bypass this?


Ok but keep in mind I didn't need any special access to the SMTP server since the mail client already uses it. I just needed the address and boom it worked. Here is a snipet of the code:

Private Sub prcSendMail(pstrFrom As String, pstrTo As String, pstrSubject As String, pstrBody As String, pbShowConfirm As String, Optional pstrAttachPath As String = "", Optional pstrCC As String = "", Optional pstrBCC As String = "")
'20110303 prl new
Const cstrSMTPServer = "smtpyourrelayaddres.somedomain.com"
Const cintCDOSendUsingPort = 2
Dim objConfig, objMsg

If (Len(pstrFrom & "") > 0) And (Len(pstrTo & "") > 0) And (Len(pstrSubject & "") > 0) And (Len(pstrBody & "") > 0) Then
Set objConfig = CreateObject("CDO.Configuration")
objConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cintCDOSendUsingPort
objConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = cstrSMTPServer
objConfig.Fields.update

Set objMsg = CreateObject("CDO.Message")
Set objMsg.Configuration = objConfig

objMsg.FROM = pstrFrom
objMsg.to = pstrTo

If Len(pstrCC & "") > 0 Then objMsg.CC = pstrCC
If Len(pstrBCC & "") > 0 Then objMsg.BCC = pstrBCC
If pstrAttachPath <> "" Then objMsg.AddAttachment pstrAttachPath ' Attach specified file, if any

objMsg.Subject = pstrSubject
objMsg.HTMLBody = pstrBody
objMsg.Send
Set objMsg = Nothing
Set objConfig = Nothing
Else
MsgBox "Eamil not sent. Make sure you fill in a subject and meessage text!", vbCritical, "Email Canceled"
Exit Sub
End If
If pbShowConfirm = vbYes Then
MsgBox "An Email Has been Sent Concerning this Message", vbCritical, "Send Email"
End If
End Sub

The web addresses above don't exactly point to a internet address they are needed for the object. Don't ask me why but that was how it was explained.

Good luck.
 
I guess I will have to see if I can find out what the SMTP server address is. The only server that I could find in my Email settigns was not in that format, so I am not sure it would work. It was listed under server, but it was xxxxxx/xxxx/xxxx format.
 
I guess I will have to see if I can find out what the SMTP server address is. The only server that I could find in my Email settigns was not in that format, so I am not sure it would work. It was listed under server, but it was xxxxxx/xxxx/xxxx format.


If your a developer in your organization. A quick call to the network staff should be all you need to find out your internet mail relay.

With this option though the mail will go out through the internet and if the recipient is a person in your department the mail will look as if it came from outside.

Cheers!!
 
Ok, I finally got the name of our server, but I keep getting an error message runtime error '-2147220960 (80040220)' The "SendUsing" configuration is invalid.

I am calling it from a button on a form currently with fixed inputs. Does this just mean the server/port I was given is not correct?

Private Sub Command67_Click()
Call prcSendMail("Field Defect Submission", "xxx@mycompany.com", "New Defect Submitted", "There has been a new defect submitted by " & [Submittedby], "", "", "", "")
End Sub

Public Sub prcSendMail(pstrFrom As String, pstrTo As String, pstrSubject As String, pstrBody As String, pbShowConfirm As String, Optional pstrAttachPath As String = "", Optional pstrCC As String = "", Optional pstrBCC As String = "")
'20110303 prl new
Const cstrSMTPServer = "**mySMTP.com**"
Const cintCDOSendUsingPort = 25
Dim objConfig, objMsg
If (Len(pstrFrom & "") > 0) And (Len(pstrTo & "") > 0) And (Len(pstrSubject & "") > 0) And (Len(pstrBody & "") > 0) Then
Set objConfig = CreateObject("CDO.Configuration")
objConfig.Fields.Item("http given") = cintCDOSendUsingPort
objConfig.Fields.Item("http given") = cstrSMTPServer
objConfig.Fields.Update
Set objMsg = CreateObject("CDO.Message")
Set objMsg.Configuration = objConfig
objMsg.FROM = pstrFrom
objMsg.to = pstrTo
If Len(pstrCC & "") > 0 Then objMsg.CC = pstrCC
If Len(pstrBCC & "") > 0 Then objMsg.BCC = pstrBCC
If pstrAttachPath <> "" Then objMsg.AddAttachment pstrAttachPath ' Attach specified file, if any
objMsg.Subject = pstrSubject
objMsg.HTMLBody = pstrBody
objMsg.Send
Set objMsg = Nothing
Set objConfig = Nothing
Else
MsgBox "Eamil not sent. Make sure you fill in a subject and meessage text!", vbCritical, "Email Canceled"
Exit Sub
End If
If pbShowConfirm = vbYes Then
MsgBox "An Email Has been Sent Concerning this Message", vbCritical, "Send Email"
End If
End Sub
 
Your first field must be a valid email address. the first null (after the body text) must be vbyes or vbno to show confirmation since it's not optional.

That's all I can see from your example.

It could be the server name but without seeing what it is I couldn't tell you for sure.
 

Users who are viewing this thread

Back
Top Bottom