Auto replies using Outlook or similar

davidjpowell

MB Enthusiast
Joined
Nov 8, 2007
Messages
4,904
Location
Doncaster
Car
Range Rover Vogue, Volvo XC60 and crappy Pug 307
I have a new website. One of the features is the ability to request an email easily giving details of our service, if someone is too busy to study the website.

The email arrives looking like this:

Email
thisisthe@email.co.uk
IP Address
81.136.230.115
User-Agent (Browser/OS)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; GTB6.5; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; FDM)
Referrer
http://www.lrplans.co.uk/


The subject is always "Please send a LRPLAN email to this person." (the site is www.lrplans.co.uk ).

Any ideas on how to get Outlook to strip the email address so that I can auto send a reply?

Cheers as always...

David
 
OP
OP
D

davidjpowell

MB Enthusiast
Joined
Nov 8, 2007
Messages
4,904
Location
Doncaster
Car
Range Rover Vogue, Volvo XC60 and crappy Pug 307
That was a good idea, although for some reason autoreply is being awkward about working. Will try harder today...
 

Noodle-Pulp

Active Member
Joined
Aug 4, 2009
Messages
798
Location
Northants
Car
C250CGI, previous C230 Coupe, SLK200, C200 Coupe
Better late than never as they say... did you manage to resolve this David?
 
OP
OP
D

davidjpowell

MB Enthusiast
Joined
Nov 8, 2007
Messages
4,904
Location
Doncaster
Car
Range Rover Vogue, Volvo XC60 and crappy Pug 307
No. I altered the form so that the sender address appears in the From field, but the reply to based on subject is a client side rule, which is not quite what I was after. Can't get it to work either.

I would prefer to base it on the subject as my Spam folder has caught a few of these based on the senders email, and as this changes based on the person filling in the form I cannot exclude this from the Spam protection.

Hope this makes sense!

Kind regards

David
 

Noodle-Pulp

Active Member
Joined
Aug 4, 2009
Messages
798
Location
Northants
Car
C250CGI, previous C230 Coupe, SLK200, C200 Coupe
I was thinking of a slightly different approach - what this involves is that your form creates and appends to a file. You could then run a small piece of code to read this in and send the relevant emails to the people that requested it - only downside to this is that you'll have to fiddle with your outlook rules to check emails BEFORE they're sent to do any additional work.

This means that your file would look something like this:
Subject
Something bespoke
Email
@someemail.co.uk
IP Address
81.136.230.115
User-Agent (Browser/OS)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; GTB6.5; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; FDM)
Referrer
Land Registry Compliant Plans Lease Plans Scale Plans

Notice the subject is now in the file...now consider the following small piece of VBScript - basically you'd save this on the computer that you want to read the file in and send the emails from, save it as a VBScript file and run it as and when you need to. I've coded this for daily use (in particular the move command)

' Edit this to point to the file you need to read in
ParseFile("C:\test.txt")


Function ParseFile (File2Read)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(File2Read, 1)


Do Until objFile.AtEndOfStream
strCharacters = objFile.ReadLine
if strCharacters = "subject" then
subject = objFile.ReadLine
end if
if strCharacters = "Email" then
address = objFile.ReadLine
SendMail(subject,address)
end if
Loop

'rename the file so that you don't pick up the same file again
objFSO.MoveFile File2Read, File2Read & "." & year(now) & month(now) & day(now)
End Function

Function Sendmail (subject,toAddress)

MessageSubject = subject
MessageBody = "Message Body"

Set olApp = WScript.CreateObject("Outlook.Application")
Set ns = olApp.getNamespace("MAPI")
ns.logon "","",true,false
Set newMail = olApp.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody & vbCrLf

newMail.Recipients.Add(toAddress)
newMail.Send

Set olApp = Nothing
End Function

If this sounds like it could do what you need I could help further if required.
 
Last edited:

Noodle-Pulp

Active Member
Joined
Aug 4, 2009
Messages
798
Location
Northants
Car
C250CGI, previous C230 Coupe, SLK200, C200 Coupe
Oh, of course alternatively you could have a small piece of VBA (Macro) in your outlook to parse the subject line and respond how you want to.
 
OP
OP
D

davidjpowell

MB Enthusiast
Joined
Nov 8, 2007
Messages
4,904
Location
Doncaster
Car
Range Rover Vogue, Volvo XC60 and crappy Pug 307
I think the first option, is beyond me, and the neither of the Form plugins that I use seem to allow the option of sending a form as an attachment. I'm not sure how easy it is to code, but coding is completely outside my experience alas.

The second option to Parse the Subject Line sounds more easy to manipulate? Could this be written to pick up the senders email. The email itself has been simplified to look like below with a fixed subject line.

From: <dpowell@test.co.uk>
Subject: [your-subject]


--
This mail is sent via contact form on LRplans.co.uk http://www.lrplans.co.uk
 

Noodle-Pulp

Active Member
Joined
Aug 4, 2009
Messages
798
Location
Northants
Car
C250CGI, previous C230 Coupe, SLK200, C200 Coupe
so the second option, you'd need a function to return the email address within the email body - something like this?

Function SearchBody(msgbody) As String
lines = Split(msgbody, vbCrLf)
‘–GET THE EMAIL TO SEND TO
For Each Line In lines
If InStr(Line, "Test:") Then
parsed = Split(Line, ":")
If InStr(parsed(1), "@") Then
‘return the email address
SearchBody = parsed(1)
End If
End If
Next
End Function
 

Noodle-Pulp

Active Member
Joined
Aug 4, 2009
Messages
798
Location
Northants
Car
C250CGI, previous C230 Coupe, SLK200, C200 Coupe
Will send a pm with full instructions for second method.
 

Users who are viewing this thread

Top Bottom