Symptoms
My Database Server (DB1) can send email messages via a relay through the Mail server (Mail1) (Exchange 2003)
My Web Server (Web1) cannot send mail messages via the same relay mechanism but can send ‘local’ mail
Background
I have a four-legged firewall with each of the above on different legs. None of the machines are in the same domain.
I have setup relaying on Mail1’s SMTP protocol to include only subnets
10.195.53.0 (255.255.255.0) Web1’s
10.195.52.0 (255.255.255.0) DB1’s
10.195.50.0 (255.255.255.0) Mail1’s
Analysis
The email mechanism works and connects – because both relay and local mails can be sent from DB1
The email mechanism connects from Web1 – because local mails can be sent from Web1
The firewall is not at fault because the email mechanism works for Web1 – it’s just relays that are rejected
Conclusion – something to do with the Exchange or Mail1 server security configuration – but what?
For testing purposes I use the following vbs script which will run without parameters and sends both a local and relay message.
Andrew
‘ Usage of the email subroutine
‘ cscript “C:NZTCScriptsemail.vbs” “To” “From” “Subject” “Bodytext” “AttachmentPath”
‘
‘ “To” defaults to domain @teacherscouncil.govt.nz unless it is a fully qualified address
‘ use “” to represent null text, or no attachment
Dim objargs
Dim sTo
Dim sFrom
Dim sSubject
Dim sTextBody
Dim sAttach
Set objArgs = WScript.Arguments
If objArgs.Count > 4 then
email objArgs(0), objArgs(1), objArgs(2), objArgs(3), objArgs(4)
else
email “me@a.site.to.relay.to”,”Unknown”,”Invalid email call – arguments count was ” & objArgs.Count, “Time ” & Now(), “”
email “me@local.site”,”Unknown”,”Invalid email call – arguments count was ” & objArgs.Count, “Time ” & Now(), “”
end if
‘*************************************************************************************
Sub email(sTo, sFrom, sSubject, sTextBody, sAttach)
Const cdoBasic = 1 ‘Use basic (clear-text) authentication.
Const cdoSendUsingPort = 2
Const Domain = “@local.site”
Const SMTPServer = “10.195.50.2”
Dim iMsg
Dim iConf
On Error Resume Next
‘ Create message and configuration objects
Set iMsg = CreateObject(“CDO.Message”)
Set iConf = CreateObject(“CDO.Configuration”)
‘Apply settings to the configuration object
With iConf.Fields
.Item(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”) = cdoBasic
.Item(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = cdoSendUsingPort
.Item(“http://schemas.microsoft.com/cdo/configuration/sendusername”) = “username”
.Item(“http://schemas.microsoft.com/cdo/configuration/sendpassword”) = “asecret”
.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = SMTPserver
.Item(“http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout”) = 30
.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25
.Item(“http://schemas.microsoft.com/cdo/configuration/smtpusessl”) = False
.Update
End With
‘Apply the settings to the message object
With iMsg
Set .Configuration = iConf
If InStr(1, sTo, “@”) > 0 Then .To = sTo Else .To = sTo & Domain
If InStr(1, sFrom, “@”) > 0 Then .From = sFrom Else .From = sFrom & Domain
.Subject = sSubject
.TextBody = sTextBody
If sAttach “” Then .AddAttachment sAttach
.Send
End With
‘ cleanup mail objects
Set iMsg = Nothing
Set iConf = Nothing
End Sub