Email Webcam image from Housebot

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
raptor_demon
Senior Member
Posts: 141
Joined: Tue Jul 07, 2009 12:55 pm
Location: NC

Email Webcam image from Housebot

Post by raptor_demon »

Hi,

I was playing withthe email sender, is there a way to attach a file to the emails?

What i am looking todo is email myself a webcam image when the door bell is pressed.

Thanks

Raptor
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: Email Webcam image from Housebot

Post by ScottBot »

Unfortunately, no. It's a pretty bare-bones email sending plugin.

It wouldn't surprise me if there was some command line email sending program somewhere that would allow attachments and you could just launch it when you needed to send.
Scott
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Re: Email Webcam image from Housebot

Post by Richard Naninck »

You can use this to send emails with attachments from script within HouseBot. Please try to filter out what is needed for your setup. The attachment and email sending part should be easy to filter. This does exactly what you describe.

Code: Select all

'-------------------------------------------------------
'- Grab Image, Create Log and EMail Image --------------
'-------------------------------------------------------
Sub Grab_DoorbellImage()
Dim MyShell
Dim CommandString
Dim ImageDateTime
Dim Image
Dim objImg
Dim iMsg
Dim iConf
Dim Flds

Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort   = 2
Const cdoSMTPServer      = "http://schemas.microsoft.com/cdo/configuration/smtpserver"

	Set MyShell = CreateObject("WScript.Shell")
	Set objImg  = CreateObject("ImageMagickObject.MagickImage.1")
	Set iMsg    = CreateObject("CDO.Message")
	Set iConf   = CreateObject("CDO.Configuration")
	Set Flds    = iConf.Fields
	
	With Flds
		.Item(cdoSendUsingMethod) = cdoSendUsingPort
		.Item(cdoSMTPServer)      = GetPropertyValue("EMail.Account0 Server")
		.Update
	End With
	
	SetPropertyValue "News Timer.Running", "Yes"
	RestoreRemote()
	OpenRemotePanel("Browser")
	SetPropertyValue "Browser.Start Site", "http://192.168.0.5:4716"
	
	Sleep 5000
	SetPropertyValue "Mouse Status.Action", "Login CamDVR"
	
	Sleep 3500
	SetPropertyValue "Mouse Status.Action", "Click Mouse^left,756,622,1"
	
	Sleep 1000
	ImageDateTime = L_Pad(Day(Now), 2, "0") & "-" & L_Pad(Month(Now), 2, "0") & "-" & Year(Now) & " - " & L_Pad(Hour(Now), 2, "0") & "." & L_Pad(Minute(Now), 2, "0") & "." & L_Pad(Second(Now), 2, "0")
	Image         = ImagePath & "Deurbel_" & ImageDateTime & ".jpg"
	CommandString = """C:\Program Files\Meedio\Meedio HouseBot\Config\AutoHome\Programs\CmdCapture.exe""" & _
	                " /f " & """Deurbel_" & ImageDateTime & ".jpg"" /d " & """C:\Program Files\Meedio\Meedio HouseBot\Config\AutoHome\Deurbel""" & " /q 80"
        Call MyShell.Run(CommandString, 0, True) 'True wacht zodat pas naar het Start Panel wordt gegaan na de grab
	OpenRemotePanel("Start")
	Call WriteLog("Deurbel_" & ImageDateTime)
	Call objImg.Convert(Image, "-crop" ,"691x509+14+108", Image)
	
	Sleep 2000

	With iMsg
    	    Set .Configuration = iConf
		.To            = GetPropertyValue("EMail.Account0 User")
		.From          = GetPropertyValue("EMail.Account0 User")
		.Subject       = "Deurbel"
		.TextBody      = ""
		.AddAttachment Image
		.Send
	End With
		
	Set Flds    = Nothing
	Set iConf   = Nothing
	Set iMsg    = Nothing
	Set objImg  = Nothing
	Set MyShell = Nothing
End Sub
raptor_demon
Senior Member
Posts: 141
Joined: Tue Jul 07, 2009 12:55 pm
Location: NC

Re: Email Webcam image from Housebot

Post by raptor_demon »

Worked great thanks!
Post Reply