Jump to content

Help With Vbs - Sending Email


WxGuy1

Recommended Posts

I have an XP machine; I know PHP and some other languages, but I'm not familiar (at all) with VB... I need to monitor a folder for a new file. When a new file appears in that folder, the script will attach it to an email and send it to an address. I've Googled around and found a script that should do something like this... Well, I modified two scripts to do the two things I need it to do (watch a folder for a new file, then attach that file as an attachment and email). Part of a script is copied below - I set it up just to test the email part.

 

>	Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "******@**********.com"
objMessage.To = "******@**********.com"
objMessage.TextBody = "This is a received fax."
objMessage.AddAttachment "c:\Received Faxes\test_received_fax.txt"

'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "###.##.##.###"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = Basic

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "******+******.com"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "*****"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 26

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==
objMessage.Send

 

However, when I run that script, I receive the following error:

Script: C:\send_email_vbs.vbs

Line: 44

Char: 5

Error: The server rejected the sender address. The server response was: 550 Access denied - Invalid HELO name (See RFD281 4.1.1.1)

Code: 8004020E

Source: (null)

 

Any help? I've tested different ports, Yes or No to SSL, etc, so I'm not sure it's a settings issue (i.e. I think it may be more of a code issue, not a settings issue). Thanks!

Edited by WxGuy1
Link to comment
Share on other sites

I found this on a google search:

 

http://forums.wirenine.com/f11/550-access-...ello-name-t599/

 

I am afraid I don't know any VB, so am not sure that is even along the right lines of what you are looking for.

 

Thanks for the reply. I think I've found a little utility that will make it a bit easier. Haven't tried it yet, but is sounds like it'll work. OSSMTP, in case any others end up wondering the same.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...