Configuring Exim to use Gmail as a Smarthost

Add a router before or instead of the dnslookup router:

  driver = manualroute
  transport = gmail_relay
  route_list = *

Add a transport:

  driver = smtp
  port = 587
  hosts_require_auth = <; $host_address
  hosts_require_tls = <; $host_address

Add an authenticator (replacing and mypassword with your own account details):

  driver = plaintext
  public_name = LOGIN
  hide client_send = : : mypassword

$host_address is used for hosts_require_auth and hosts_require_tls instead of to avoid occasional 530 5.5.1 Authentication Required errors. These are caused by the changing IP addresses in DNS queries for $host_address will expand to the particular IP address that was resolved by the gmail_route router.

<; is required for the hosts_require_auth and hosts_require_tls lists because $host_address can contain colons (the default list separator character) when sending with IPv6.

Truncating SQL Server Log Files

SQL Server logs in a circular fashion to its transaction log files. To shrink a transaction log file it is first necessary to backup the log.

The following script backs the log up, throwing away the backup in the process and then shrinks the files in the database. Make sure you have a full backup of the database before running.

declare @db varchar(50)
set @db = DB_NAME()

backup log @db with truncate_only
dbcc shrinkdatabase (@db, truncateonly)

Converting Active Directory Date Time Attributes

To convert a date time attribute in Active Directory (e.g. as used by lastLogon) to a human readable date time, you can use the w32tm command.

For example with the following LDAP record:

dn: CN=John Smith,CN=Users,DC=DC=example,DC=com
lastLogon: 128326919184182832


w32tm /ntte 128326919184182832

Will give the output

148526 12:38:38.4182832 - 27/08/2007 13:38:38 (local time)

See Microsoft Knowledge Base article 555936 for more information.