Send email without Outlook

coolcatkelso

Registered User.
Local time
Today, 19:33
Joined
Jan 5, 2009
Messages
279
Hey guys

I was searching around and found this topic - http://www.access-programmers.co.uk/forums/showthread.php?t=111046

I took a look and managed to get it working, it sends an email using my BT Yahoo account without anyone knowing, no outlook or other client.. Now I can send a daily report from my distrubuted Dbase :D great I can spy on my customers and see what they are doing lol joking

Anyway, I was wondering how I could attach a report to this?

Here is the code that is the "Send Button"

Code:
Private Sub cmdSend_Click()
  If Trim(txtServer) = "" Then
    MsgBox "Enter the server name or IP address"
    txtServer.SetFocus
    Exit Sub
  ElseIf Trim(txtMailFrom) = "" Then
    MsgBox "Enter the sender e-mail address"
    txtMailFrom.SetFocus
    Exit Sub
  ElseIf Trim(txtSendTo) = "" Then
    MsgBox "Enter the recipient e-mail address"
    txtSendTo.SetFocus
    Exit Sub
  ElseIf cmbAuth.ListIndex = 1 And Trim(txtPOPServer) = "" Then
    MsgBox "POP Authentication requires POP server"
    txtPOPServer.SetFocus
    Exit Sub
  End If
  If Trim(txtMessageSubject) = "" Then
    If MsgBox("You didn't enter the message subject. " & vbCrLf & _
    "Would you like to send it anyway?", vbYesNo) = vbNo Then Exit Sub
  End If
  If Trim(txtMessageText) = "" Then
    If MsgBox("You didn't enter the message text. " & vbCrLf & _
    "Would you like to send it anyway?", vbYesNo) = vbNo Then Exit Sub
  End If
'  txtStatus.SetFocus
  With oSMTP
    'authentication
    If cmbAuth.ListIndex > 0 Then
      .username = txtUsername
      .password = txtPassword
    End If
    If cmbAuth.ListIndex = 1 Then .POPServer = txtPOPServer
    .AuthenticationType = cmbAuth.ListIndex
    
    .Server = txtServer
    .MailFrom = txtMailFrom
    .SendTo = txtSendTo
    .MessageSubject = txtMessageSubject
    .MessageText = txtMessageText
        If Me.Text40 > "" Then
        .Attachments.Add Me.Text40
    End If
    If Me.Text44 > "" Then
        .Attachments.Add Me.Text44
    End If
    If Me.Text47 > "" Then
        .Attachments.Add Me.Text47
    
    End If
    .SendEmail
  End With
  
End Sub

Obvisouly I tried the standard access code - DoCmd.SendObject , acSendReport, "Absent Employees"

but as you can guess, it brought up outlook? Any other way to add a report in without having to save it and add as attachment?
________
Kitchen Measures
 
Last edited:
Its ok guys I found away round this

I just added the fields I needed and changed a bitof the vba to include this

Now if I click send on the form, I get am email from "Databank" with the following -

Databank has been accessed by TestCompany at 09/01/2010 17:17:01

So now if someone is using my Dbase I can match there details to those I have n my system so I am able to see who is using, and, have they paid, is it a legal copy

You could include any field from your Dbase and work with this too

Handy to send an email to yourself etc without the end user knowing
Just hide all your details in the SMTP part and mask the password.. I would suggest creating a free email from somewhere, one that is used to send the email frm your dbase.

Very clever little thing

________
Coach purses
 
Last edited:

Users who are viewing this thread

Back
Top Bottom