Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

sending  EMail via ms access from a device connected to a server

Posted on 2011-05-07
9
Medium Priority
?
337 Views
Last Modified: 2012-06-27
Hi:
i use two deferent ways to send EMail
you can see the attach code below
both of them are work in a proper way when i run it from any single machine.
but i have this err msg when run from a machine works under a server
"The transport failed to connect to the server"
please help, know nothing in servers

Function fnSendIntraEmail(strEMailTo As String, strMailSubj As String, strMsgBody As String)
On Error GoTo Err_fnSendIntraEmail

    Dim strDocName As String
    Dim strEmail As String
    Dim strMailSubject As String
    Dim strMsg As String

    strDocName = "rptSendMessage"
    strEmail = strEMailTo & vbNullString
    strMailSubject = strMailSub & vbNullString
    strMsg = strMsgBody & vbNullString & vbCrLf & vbCrLf & "Your Name" & _
        vbCrLf & "MailTo:MyEMail@gmail.com"
    
    DoCmd.SendObject objecttype:=acSendReport, _
        ObjectName:=strDocName, outputformat:=acFormatHTML, _
        To:=strEmail, Subject:=strMailSubject, MessageText:=strMsg

Exit_fnSendIntraEmail:
    Exit Function

Err_fnSendIntraEmail:
    MsgBox err.Description
    Resume Exit_fnSendIntraEmail
    
End Function

Open in new window

Option Compare Database

Function fnSendEMail(tbGmailLogin As String, tbTo As String, tbPassword As String, _
                      tbMsgSubject As String, tbMsgBody As String)
On Error GoTo fnSendEMail_Err
'original code by westconn1

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = tbMsgSubject
objMessage.FROM = tbGmailLogin
'objmessage.To = Me.tbTo & "@stc.com.sa"
objMessage.To = tbTo
objMessage.TextBody = tbMsgBody
'objMessage.AddAttachment "c:\EMail_temp\tblBills.txt" '  --> change it for the path of your file(attachment)

 objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
 
'Name or IP of Remote SMTP Server
  
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = tbGmailLogin
 
'Your password on the SMTP server
 
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = tbPassword
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
'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") = 30
objMessage.Configuration.Fields.Update
objMessage.send
Set objMessage = Nothing

'Call MsgBox("E-mail sent via Gmail SMTP", vbInformation, Application.Name)
MsgBox " Êã ÅÑÓÇá ÑÓÇáÊß ", vbExclamation

fnSendEMail_Exit:
    Exit Function

fnSendEMail_Err:
    MsgBox Error$
    Resume fnSendEMail_Exit

End Function
Function fnExportToTxt()
On Error GoTo fnExportToTxt_Err

DoCmd.TransferText acExportDelim, , _
    "tblBills", "C:\EMail_temp\tblBills.txt"

fnExportToTxt_Exit:
    Exit Function

fnExportToTxt_Err:
    MsgBox Error$
    Resume fnExportToTxt_Exit

End Function

Open in new window

0
Comment
Question by:Mohammad Alsolaiman
  • 5
  • 2
  • 2
9 Comments
 
LVL 85
ID: 35711805
What do you mean by "machine works under a server"? Can you describe the environment a bit more clearly?
0
 
LVL 40

Accepted Solution

by:
als315 earned 1336 total points
ID: 35711933
If your server have firewall enabled - port  465 should be opened for output
0
 

Author Comment

by:Mohammad Alsolaiman
ID: 35714449
hello
i mean any pc connect to a lan (local network)
the operating system is windows 2000 server
i can figure out that they use port no 8080 for internet
can i use that port instead
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 664 total points
ID: 35715092
Sendobject uses the default email client on the machine. Do you have an email client installed and configured on the workstations? If so, make sure to test the email client to insure it can send and receive email.

Note also that your email system may be setup to disallow external programs from using it.

Do you know what email system you're using?
0
 

Author Comment

by:Mohammad Alsolaiman
ID: 35739817
"Do you have an email client installed and configured on the workstations"
I don’t know what u mean by "email client"
Do you know what email system you're using?
Do you mean by " email system you're using" outlook for examble?
If so? Then I use outlook.
I try telnet on the server (which I have the problem) and on my pc(which works in appropriate way)
But I get the same result "connect failed"
So it seem to me is nothing to do with the port? Maybe! Actually I am 0 level in networking.

Clipboard01.jpg
0
 

Author Comment

by:Mohammad Alsolaiman
ID: 35739838
als315:
"If your server have firewall enabled - port  465 should be opened for output"
How to enable that port please?
0
 
LVL 40

Assisted Solution

by:als315
als315 earned 1336 total points
ID: 35743854
Try telnet to smtp server's (smtp.gmail.com) port 465
telnet smtp.gmail.com 465
If you will not be able to do it, you should know - what firewall (proxy) is installed on your server.
Are you sure - 192.168.1.254 is address of Windows 2000 server? More likely it is hardware firewall (router). In this case you should find it's model.
0
 

Author Comment

by:Mohammad Alsolaiman
ID: 35745281
I am sorry
I was telnetting to IPv4 address on my PC, and that's why I get failed.
But when I telnetting to Default Gateway , I got the "clear DOS Prompt"
At server side, the tech guy telnet on that port "465" and it's failed.
So I will request from the IT department to open that port, and see what will happen.
I am trying to make a small test environment, (windows server 2003, and one client) , and try to send an Email from my ms access program.
If I get the same error, I will try to open the port on the server, then try again.
Maybe this scenario will help solving the problem. I hop.
0
 

Author Closing Comment

by:Mohammad Alsolaiman
ID: 35822523
thanks to every body
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have had my own IT business for a very long time. I started mostly with hardware and after about a year started to notice a common theme. I had shelves with software boxes -- Peachtree, Quicken, Sage, Ouickbooks -- and yet most of my clients were…
This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question