Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

smtp server settings using CDO.message 1

Status
Not open for further replies.

intomuso

Programmer
Jan 26, 2006
19
GB
Hi,

I'm getting no emails through using the CDO.message object.

It was originally working OK with the default SMTP virtual server settings. I then went and started trying to enhance the security by changing these settings for another purpose not to do with CDO.Message. Anyway I then returned the settings to as they were when CDO.message was working and the component is somehow blocking emails being sent via the method.

Does anyone have any hints.

Thanks for your help in advance.

Set myMail=CreateObject("CDO.Message")
myMail.Subject="TEST"
myMail.From="email"
myMail.To= "email"


myString = myString & "<html><head>" & Chr(13) & Chr(10) &

mystring = mystring & "</body></html>" & Chr(13) & Chr(10) & Chr(13) & Chr(10)

myMail.HTMLBody= mystring

myMail.Send
set myMail=nothing

Gavin
 
We can only speculate what security you have locked down since you don't give any examples. I would say that you need to add the IP address of the system running the script to the allowed list for your SMTP server. It sounds like you have blocked access from Authenticated Computers (a good thing) but you need to add the exception for any networked scanner/printers and systems running scripts.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Hey Gavin,

Go into the SMTP service listed in IIS and enable the logging. This should give you with at least a beginning for troubleshooting and you can paste part of the log to get additional suggestions.



Brendan Murtagh - HostMySite.com
Technical Support Representative
bmurtagh@hostmysite.com
 
Hi,

Thanks for the advice, I'm currently allowing any ip. these are the settings below.

Access -> Authentification -> tick allow anonymous access

Access -> Connection -> radio button on, All except the list below

Access -> Relay Restrictions -> radio button on, All except the list below and tick box, Allow all the computers which successfully authenticate to relay, regardless of list above.

Delivery -> Outbound security -> anonymous access

Looked at the logs but they don't tell me much

time - ipadd- --0

BTW I should maybe mention that I'm using a matrix email program on the server. I don't understand why it should suddenly stop working when it was working before.

Appreciate any other ideas, many thanks.

Gavin
 
Can you telnet to the server on port 25?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Hi Mark,

yes I get '220 mymailserver simple mail transfer service ready'

any other ideas?

thanks

gavin
 
Try this code instead
Code:
Dim strFrom, strMyIP, strTo, strAttachmentPath
 
' Set the company specific information
strFrom = "markdmac@thespidersparlor.com"
' Set the SMTP server IP
strMyIP = "mail.thespidersparlor.com" 
' Where do you want the message to be delivered
' Use semicolons to seperate multiple addresses
strTo = "mark@higleygroveshoa.com"
strAttachmentPath = "\\server\share\file.txt"

' Set the visual basic constants as they do not exist within VBScript.
' Do not set your smtp server information here.
Const cdoSendUsingMethod = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing",[/URL] _
cdoSendUsingPort = 2, _
cdoSMTPServer = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver"[/URL]

' Create the CDO connections.
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

' SMTP server configuration.
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort

' Set the SMTP server address here.
.Item(cdoSMTPServer) = strMyIP
.Update
End With

' Set the message properties.
With iMsg
Set .Configuration = iConf
.To = strTo
.From = strFrom
.Subject = "File Update"
.TextBody = "Here is the latest version of the file as of " & now
' An attachment can be included.
'.AddAttachment strAttachmentPath
End With

'Send high priority
iMsg.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High" ' For Outlook 2003
iMsg.Fields.Item("urn:schemas:mailheader:X-Priority") = 2 ' For Outlook 2003 also
iMsg.Fields.Item("urn:schemas:httpmail:importance") = 2 ' For Outlook Express
iMsg.Fields.Update

'Send the message.
iMsg.Send 

MsgBox "Done"

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Hi Mark,

That works a treat, thank v much for your help.

gavin
 
Happy to help.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top