473,700 Members | 2,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help sending email

B
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("C DO.Message")

objEmail.From = "se**@test. com"
objEmail.To = "re*****@test.c om"
objEmail.Subjec t = "TEST SUBJECT"
objEmail.AddAtt achment "\\server\test. csv"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendusing") = 2
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/smtpserver") = "SERVER_NAM E"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/smtpauthenticat e") = 1
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendusername") = "username"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendpassword") = "userpwd"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/smtpserverport" ) = 25
objEmail.Config uration.Fields. Update
objEmail.Send

set objEmail = nothing
Jun 23 '06 #1
3 2304
Hi B

One thing you might try is change
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendusing") = 2 to objEmail.Config uration.Fields. Item("http://schemas.microso ft.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.c sv 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*********@wh itehouse.gov"," Test
Subject", "Test Body"
Main = DTSTaskExecResu lt_Success
End Function

Sub email_alert(str To, strFrom, strSubject, strBody)
Dim iConf 'As CDO.Configurati on
Dim imsg 'As CDO.Message
Dim flds

Set imsg = CreateObject("C DO.Message")
Set iConf = CreateObject("C DO.Configuratio n")

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.microso ft.com/cdo/configuration/sendusing") =
"2"
.Item("http://schemas.microso ft.com/cdo/configuration/smtpserver") =
"smtp-server.mn.rr.co m"
.Item("http://schemas.microso ft.com/cdo/configuration/smtpconnectiont imeout")
= 10
.Update
End With

Set imsg.Configurat ion = iConf
imsg.To = strTo
imsg.From = strFrom
imsg.Subject = strSubject
imsg.TextBody = strBody
imsg.AddAttachm ent "c:\log\myfile. txt"
imsg.Send
End Sub
--
-Dick Christoph

"B" <no_spam@no_spa m.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("C DO.Message")

objEmail.From = "se**@test. com"
objEmail.To = "re*****@test.c om"
objEmail.Subjec t = "TEST SUBJECT"
objEmail.AddAtt achment "\\server\test. csv"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendusing") = 2
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/smtpserver") = "SERVER_NAM E"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/smtpauthenticat e") = 1
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendusername") = "username"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendpassword") = "userpwd"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/smtpserverport" ) = 25
objEmail.Config uration.Fields. Update
objEmail.Send

set objEmail = nothing

Jun 23 '06 #2
B
Follow-up to my original post below.

Is it possible for the "objEmail.T o" 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_spa m.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("C DO.Message")

objEmail.From = "se**@test. com"
objEmail.To = "re*****@test.c om"
objEmail.Subjec t = "TEST SUBJECT"
objEmail.AddAtt achment "\\server\test. csv"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu ration/sendusing") = 2
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu ration/smtpserver") = "SERVER_NAM E"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu ration/smtpauthenticat e") = 1
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu ration/sendusername") = "username"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu ration/sendpassword") = "userpwd"
objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu ration/smtpserverport" ) = 25
objEmail.Config uration.Fields. Update
objEmail.Send

set objEmail = nothing

Jun 28 '06 #3
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_spa m.com> wrote in message
news:c4******** *************** *******@rcn.net ...
Follow-up to my original post below.

Is it possible for the "objEmail.T o" 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_spa m.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("C DO.Message")

objEmail.From = "se**@test. com"
objEmail.To = "re*****@test.c om"
objEmail.Subjec t = "TEST SUBJECT"
objEmail.AddAtt achment "\\server\test. csv"

objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendusing") = 2

objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/smtpserver") = "SERVER_NAM E"

objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/smtpauthenticat e") = 1

objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendusername") = "username"

objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/sendpassword") = "userpwd"

objEmail.Config uration.Fields. Item("http://schemas.microso ft.com/cdo/configu
ration/smtpserverport" ) = 25
objEmail.Config uration.Fields. Update
objEmail.Send

set objEmail = nothing


Jun 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1790
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 loop, it updates the SENT field of the processed row to mark it sent. I have a sleep function in there to slow the processing down to see if that alleviated the following problem - it did help. What is happening is the first 20 emails it sends...
8
5473
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
2
2223
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 figure out how to do it. For instance, my records look like this: strEmail strGroup jjohns@comcast.net catlovers jjohns@comcast.net doglovers
1
1265
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 also tried using Chr(10) & Chr(13) and Environment.NewLine but these didn't help either. Anyone have any idea what is going on? Thanks in advance!
10
3534
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 recommend ? Help!!!
6
2787
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 capturing user computer user name i have done... my problem is .... i need the unregistered user to log in to my site and from there there will be a link for them to key in their short information in a textbox and a html email will be sent to...
6
4993
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 for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a PDF. It works fine so far....
9
3459
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 oSMTP.Send(oMailMessage) (in this line I am getting the above err)
2
1929
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: #prova invio email smtpserver = smtplib.SMTP(mailserver) messaggio= "Messaggio di prova" print mail print messaggio
2
234
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 data transfer using encryption techniques. Objectives can be summarized as: • Designing and implementing server applications • Designing and implementing client applications • Encrypting and decrypting o Use of DES, RSA o Use of hash...
0
8648
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9218
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9081
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8929
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5904
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3095
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2031
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.