Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Send mail with Attachment via VBscript

174 views
Skip to first unread message

Larry Bird

unread,
Nov 8, 2007, 4:56:02 PM11/8/07
to
I'm trying to send mail with an attachment via VBscript. When I execute the
script I get the following message:

Error: The transport failed to connect to the server.

Code: 80040213
CDO.Message.1

What is it really trying to tell me?

This is vanilla VBscript. No ASP

Here's the Code:

Function SendMail(ToMailBox, FromMailBox, Subject, MailBody, FileAttachment)

Dim Mailobj

msgbox(ToMailBox)
msgbox(FromMailBox)
msgbox(Subject)
msgbox(MailBody)
msgbox(FileAttachment)

Set Mailobj = CreateObject("CDO.Message")


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

Mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "AAAA"
Mailobj.Configuration.Fields.Update()


Mailobj.Subject = Subject
Mailobj.From = FromMailBox
Mailobj.To = ToMailBox
Mailobj.TextBody = MailBody
Mailobj.AddAttachment "C:\Archive\ImportExport11-8-2007.txt"
'FileAttachment

Mailobj.Send

End Function

McKirahan

unread,
Nov 8, 2007, 6:57:07 PM11/8/07
to
"Larry Bird" <Larr...@discussions.microsoft.com> wrote in message
news:9F432B92-0FB9-4B3B...@microsoft.com...

Is "AAAA" really your SMTP server?

(The attachment filename is hardcoded rather than using the parameter.)


McKirahan

unread,
Nov 8, 2007, 7:30:27 PM11/8/07
to
"McKirahan" <Ne...@McKirahan.com> wrote in message
news:0bqdnZXFuYukP67a...@comcast.com...

> "Larry Bird" <Larr...@discussions.microsoft.com> wrote in message
> news:9F432B92-0FB9-4B3B...@microsoft.com...
> > I'm trying to send mail with an attachment via VBscript. When I execute
> the
> > script I get the following message:
> >
> > Error: The transport failed to connect to the server.
> >
> > Code: 80040213
> > CDO.Message.1

http://www.systemwebmail.com/faq/4.3.9.aspx

4.3.9 The transport failed to connect to the server.

This is a network related error.
Your application cannot connect to the mail server specified

SmtpMail.SmtpServer

* Is a valid SMTP Server
* Check to be sure the server System.Web.Mail is executing
on can connect to the mail server.
Some times firewalls or proxy servers can get in the way.
* Try specifying the value by IP address.
Poor DNS resolution can sometimes hinder name lookups.
* Make sure the that the mail server is running at port 25
* If you did not specify a SmtpMail.SmtpServer property,
or if SmtpMail.SmtpServer points to "localhost" (or the equivalent),
be sure the SMTP Service is running on port 25.
* For testing purposes change the MailMessage.From and MailMessage.
To properties to an address that exists on SmtpMail.SmtpServer.
Some times this exception is thrown, when it really is a relay issue.


Perhaps this link will help: http://www.paulsadowski.com/WSH/cdo.htm

Google is your friend.


Larry Bird

unread,
Nov 8, 2007, 8:24:01 PM11/8/07
to
My SMTP name is not 'AAAA'. I'll check the other suggestions.

Thanks

0 new messages