Posts Tagged ‘mail’

If you have a local mail server installed and change your server controlpanel to ISPConfig 3, having used ISPConfig 2 in the past, you may have to change the value that defines the form field observed by all functions in need of the address that mails are supposed to be delivered to (catchalls, etc.) on your mail server preferences since the identifier has changed from X-Delivered-To to Delivered-To in ISPConfig 3; otherwise the system won’t be able to find the necessary information in the mails’ headers.

Restart the server afterwards and you should find it working again.

Thanks to Alexander Fox for this post!

Send Mails Via Remote Server With VBScript (Windows)

Wednesday, November 16, 2011 posted by CSch

You can use MS Windows’ VBScript to write a script that is able to log into a remote mail server such as googlemail or any other with your account data and send mails from that server. This can be used to retrieve logs via attachments or to just automate mail processes. The bare script to send a mail looks as follows (the apostrophe after a line signals a comment to the lines content, it does not belong to the script. The data all go inside the doublequotes if there are any):

Set objMessage = CreateObject(“CDO.Message”)

objMessage.Subject = “Type in the mail’s subject here

objMessage.From = “ <the sender mail goes here, you need the login data for it>
‘The mail address goes inside the tags

objMessage.To = “the receiver mail goes here

objMessage.TextBody = “Here goes the actual mail message

objMessage.Addattachment “Fill in the complete path to your attachment, otherwise leave complete line

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2
determines whether you use local smtp (1) or network (2)

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “
Fill in your smtp (outgoing) server
You can find your provider’s server address somewhere on the homepage or by googling for smtp server lists

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”) = 1
Determines the authentication mode. 0 for none, 1 for basic (clear text), 2 for NTLM

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendusername”) = “
should be the same as the sender mail – login data for your server

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendpassword”) = “
your email’s password – login data for your server

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25
This is the default port used by most servers. Find out if yours is using a different one if there are problems

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpusessl”) = False
Use SSL? True or False

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout”) = 60

Maximum time connection is tried to be established

objMessage.Configuration.Fields.Update

objMessage.Send

It is recommended not to use this script on a computer you are not the only user of, since your email and its password are openly visible. However you can just create a new one for that purpose. You can easily embed this script into any other VBScript, schedule it or do whatever you want with it.

Back up Files on Windows with HoboCopy

Tuesday, October 11, 2011 posted by CSch

HoboCopy is a commandline program that lets you copy large amounts of data in a comparatively short time to other copy functions. However, the clue is that it takes a snapshot of the file system before copying, making it possible to copy files that are being used without having to close them or end processes. It can be downloaded here:

https://github.com/candera/hobocopy/downloads

Extract the files to any directory (preferably one that is easy to access). To use it, open a Command Prompt (or cmd on Windows XP) and direct it to the directory where you have extracted the Hobocopy files to by using the cd (change directory) command. In my case, I have extracted the files onto a folder on my Desktop (the directory must be specified in double quotes if a space character was used in any of the folders’ names):

cd “C:\Users\howtoforge\Desktop\HoboCopy stable”

This is necessary if you want to run HoboCopy because it is only running through a command prompt and the command prompt cannot start it without knowing where it is located. If you doubleclicked on the HoboCopy icon in the explorer, it would only blink up for a split-second and vanish after that, and if you started it with the command without directing the prompt to its location it would only give you:

C:\Users\howtoforge>hobocopy
‘hobocopy’ is not recognized as an internal or external command,
operable program or batch file.

C:\Users\howtoforge>

The basic structure of the command looks like this: hobocopy “C:\source\directory” “C:\destination\directory”
However there are a lot of useful extra options available, as for example incremental copying, meaning it only copies the files that are new to the destination folder. A full list of options can be found here (scroll down to the USAGE section):

https://github.com/candera/hobocopy/

As example of how to use HoboCopy I am going to show you how to copy your Windows Live Mail folder to another directory to back it up (backups usually only make sense on different partitions or external hard drives, but for demonstrational purposes I am going to copy it to a folder on the same hard drive).

The Windows Live Mail folder on Windows 7 is located in “C:\Users\howtoforge\AppData\Local\Microsoft\Windows Live Mail” (the AppData folder is hidden, you may have to make it visible through the folder options in the Control Panel first). Open up a command prompt and direct it to the location of your HoboCopy file with the cd command as shown above. I want to do an incremental (includes a statefile, as said in the usage section of the project page), recursive copy of the folder, meaning that it only copies the files that are new to the destination folder and includes all subdirectories of the chosen folder, not just the files. To accomplish that, my command has to be this:

hobocopy /statefile=state.txt /incremental /recursive “C:\Users\howtoforge\AppData\Local\Microsoft\Windows Live Mail” “C:\Users\howtoforge\Desktop\destination”