My code below works fine when run from my pc (changed all the values for
obvious reasons). The code is placed inside a DTS task via VBS scripting.
But when I try to run directly from the server where sqlserver is installed,
the script fails.
I have SMTP running, but there is no outlook installed.
Can someone please advise what I am missing.
Thanks
Bob
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "se**@test.com"
objEmail.To = "re*****@test.com"
objEmail.Subject = "TEST SUBJECT"
objEmail.AddAttachment "\\server\test.csv"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu
ration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu
ration/smtpserver") = "SERVER_NAME"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu
ration/smtpauthenticate") = 1
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu
ration/sendusername") = "username"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu
ration/sendpassword") = "userpwd"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu
ration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
set objEmail = nothing 3 2292
Hi B
One thing you might try is change objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendusing") = 2
to objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendusing") = "2"
quotes around the 2.
I spent several hours a week ago trying the very same thing and that made
all the difference.
Also is \\server\test.csv accessible from the server you are running this
on?
Here is the full text of the DTS Package I wrote. Note that I don't think
all the fields you included are necessary.
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Function Main()
email_alert "dc******@yahoo.com", "Ge*********@whitehouse.gov","Test
Subject", "Test Body"
Main = DTSTaskExecResult_Success
End Function
Sub email_alert(strTo, strFrom, strSubject, strBody)
Dim iConf 'As CDO.Configuration
Dim imsg 'As CDO.Message
Dim flds
Set imsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set flds = iConf.Fields
'The http://schemas.microsoft.com/cdo/configuration/ namespace defines
the majority of fields used to set configurations for various CDO objects.
We set and update the following three fields (SendUsing, SMTP_SERVER, and
TimeOut) of the Configuration object:
With flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
"2"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp-server.mn.rr.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10
.Update
End With
Set imsg.Configuration = iConf
imsg.To = strTo
imsg.From = strFrom
imsg.Subject = strSubject
imsg.TextBody = strBody
imsg.AddAttachment "c:\log\myfile.txt"
imsg.Send
End Sub
--
-Dick Christoph
"B" <no_spam@no_spam.com> wrote in message
news:Ks******************************@rcn.net... My code below works fine when run from my pc (changed all the values for obvious reasons). The code is placed inside a DTS task via VBS scripting. But when I try to run directly from the server where sqlserver is installed, the script fails.
I have SMTP running, but there is no outlook installed.
Can someone please advise what I am missing. Thanks Bob
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "se**@test.com" objEmail.To = "re*****@test.com" objEmail.Subject = "TEST SUBJECT" objEmail.AddAttachment "\\server\test.csv" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendusing") = 2 objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/smtpserver") = "SERVER_NAME" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/smtpauthenticate") = 1 objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendusername") = "username" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendpassword") = "userpwd" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/smtpserverport") = 25 objEmail.Configuration.Fields.Update objEmail.Send
set objEmail = nothing
Follow-up to my original post below.
Is it possible for the "objEmail.To" to lookup the values from a sqlserver
table?
At the moment, I type the email address separated by a semi-colon.
TIA~
"B" <no_spam@no_spam.com> wrote in message
news:Ks******************************@rcn.net... My code below works fine when run from my pc (changed all the values for obvious reasons). The code is placed inside a DTS task via VBS scripting. But when I try to run directly from the server where sqlserver is
installed, the script fails.
I have SMTP running, but there is no outlook installed.
Can someone please advise what I am missing. Thanks Bob
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "se**@test.com" objEmail.To = "re*****@test.com" objEmail.Subject = "TEST SUBJECT" objEmail.AddAttachment "\\server\test.csv"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/smtpserver") = "SERVER_NAME"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/smtpauthenticate") = 1
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendusername") = "username"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendpassword") = "userpwd"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/smtpserverport") = 25 objEmail.Configuration.Fields.Update objEmail.Send
set objEmail = nothing
Hi B,
Well not directly but you could create an ADODB Command, Connection and
Recordset and use the command to return you a recordset from the Database
that would have 1 or many email addresses that you could concatenate
together and stick in the objEmail.To field.
--
-Dick Christoph
"B" <no_spam@no_spam.com> wrote in message
news:c4******************************@rcn.net... Follow-up to my original post below.
Is it possible for the "objEmail.To" to lookup the values from a sqlserver table?
At the moment, I type the email address separated by a semi-colon.
TIA~
"B" <no_spam@no_spam.com> wrote in message news:Ks******************************@rcn.net... My code below works fine when run from my pc (changed all the values for obvious reasons). The code is placed inside a DTS task via VBS scripting. But when I try to run directly from the server where sqlserver is installed, the script fails.
I have SMTP running, but there is no outlook installed.
Can someone please advise what I am missing. Thanks Bob
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "se**@test.com" objEmail.To = "re*****@test.com" objEmail.Subject = "TEST SUBJECT" objEmail.AddAttachment "\\server\test.csv" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendusing") = 2 objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/smtpserver") = "SERVER_NAME" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/smtpauthenticate") = 1 objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendusername") = "username" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/sendpassword") = "userpwd" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configu ration/smtpserverport") = 25 objEmail.Configuration.Fields.Update objEmail.Send
set objEmail = nothing
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: NotGiven |
last post by:
The code below is designed to loop through rows of a database query
obtaining email addresses and send an email to each. It is modified form
fomr some code I found on the net.
With each while...
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
...
|
by: kimberly.shaffer |
last post by:
Okay, I can automate sending of multiple emails with records using
Groupwise and Access DB. But now what I need to do is send multiple
fields associated with one field out automatically and can't...
|
by: David Hearn |
last post by:
I am trying to generate a short text based email and using VBCrlf to break
the lines. The problem is that they are being ignored after about the third
or fourth line down into the email. I have...
|
by: Max |
last post by:
Hi,
I am newbie developing a MailList program in asp.net c#.
To avoid be considered as a span, a would like to process some messages,
stops, process some messages, stops......
What do you...
|
by: \jason via DotNetMonster.com\ |
last post by:
currently i am doing a personal website and keep on changing the aspect...
finally the finall decision is to have a login page (requirement in asp.net,
vb.net) and the login with security part of...
|
by: James Radke |
last post by:
Hello,
I have a multithreaded windows NT service application (vb.net 2003) that I
am working on (my first one), which reads a message queue and creates
multiple threads to perform the processing...
|
by: JoeP |
last post by:
Hi All,
How can I find the reason for such an error: Failure sending mail.
Some Code...
oMailMessage.IsBodyHtml = False
oMailMessage.Body = cEmailBody
Dim oSMTP As New SmtpClient...
|
by: ornto |
last post by:
Hi, I'm trying to create an application which checks a
dynamic web site and on certain events sends an email to me.
My problem though is with the email task. By now I made this
simple test code:
...
|
by: ahmadoubay_20240 |
last post by:
The assignment aims at enforcing the encryption and communication
techniques. It helps the student in acquiring the necessary knowledge
in developing client/server application and in securing...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |