Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I send an email from access db form 1

Status
Not open for further replies.

NakedZero

Technical User
Oct 27, 2004
21
US
I have been searching google/newsgroups and other searches and found this really cool VB code:

"basically it can be made into an exe and you can send "spoofed" emails with attachments. Now the problem I am having is trying to figure out how to use it in access, or if there is a better way to do this please, help. I have seen countless places where people have asked and been shot down with "if a person needs to send spoofed email, then they are most likely going to spam". This is not my intent. I have also read the thread in here where someone has asked but it did not have any information as how to accomplish this. I have a database wherein there are approximately 60 to 100 different users going in for a specific request to be mailed or faxed. I would now like to incorporate the use of email. We are all using Lotus Notes, but I want to stay away from coding it in Lotus, becuase we are being advised that we may be changing our email program to something else.
If anyone knows how to send emails from access through the method at the above link it would really be appreciated. I am not asking for anyone to come up with the answer after hours of research, just if anyone already knows how to do this or can point me to the right direction,

Thanks!
 
You need to put the vbSendMail.dll in a folder (preferably in Windows\System or Windows\System32) and then register it with [tt]RegSvr32 vbSendMail.dll[/tt] from a command prompt.

Once you register the dll it will appear in your references as "SMTP Send Mail for VB6.0" and you can use it in your project as described in detail in the Word document that accompanies the download. The code would be similar to this:
Code:
Sub SendVBMail()
  Dim sm As New vbSendMail.clsSendMail
  
  With sm
    .Recipient = "joeblow@us.org"
    .Attachment = "c:\attachment.xls"
    .POP3Host = "pop.wans.net"
    .Send
  End With
End Sub

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
WOW! It works! your suggestion on registering it was the part I was missing! I hard coded it in access and it now sends the email, but the problem is being able to set the txtBox email address to pass the value into the code. I tried to setfocus, that didn't work. Maybe by dimming the txtbox as a string it will work. I will give it a shot...

Thanks again for your suggestion!

Hopeless Programmer..
 
You can get the textbox.Value without setting focus on it.

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
I can't tell you how thankfull I am, I did however get a chance to actually get it to work they way you stated, Again, thanks for all your help!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top