Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 email from ftp

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2007-05-31 : 14:08:14
I have tried a few different stored procedures but i'm looking for away to send email from a server that does not have email enabled. (I want to pass in the smtp server and email and password.

Does anyone know of any script?

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2007-05-31 : 16:36:33
One thing you can do is use a powershell script.
see : http://26thgstreet.blogspot.com/2007/05/smtp-using-net-classes-powershell.html

from tsql, there are plenty of scripts using cdosys or cdonts.
http://www.sqlservercentral.com/scripts/viewscript.asp?scriptid=287 (maybe you need an account to view that)
or see : http://www.dotnetjohn.com/articles.aspx?articleid=157

google for tsql + cdosys or tsql + cdonts

rockmoose
Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2007-06-01 : 01:39:03
EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', cdoSMTPServerName

How can I also add a username and password for that SMTP server?

thanks
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2007-06-01 : 11:38:34
Experiment with the following:

set values for smtpauthenticate using:
cdoAnonymous 0 Perform no authentication.
cdoBasic 1 Use the basic (clear text) authentication mechanism.
cdoNTLM 2 Use the NTLM authentication mechanism.

EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate").Value', '1'
EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/SendUserName").Value', @UserName
EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/SendPassword").Value', @Password

rockmoose
Go to Top of Page

mrjoli021
Starting Member

3 Posts

Posted - 2007-06-02 : 09:37:13
you can use telnet to connect to a remote smtp server.

telnet smtpserver 25
helo domain.com
MAIL FROM: a valid e-mail address
RCPT TO: the recepient
SUBJECT:
DATA:

End on and empty line with a "."

Here is the link if you get stuck

http://www.yuki-onna.co.uk/email/smtp.html
Go to Top of Page
   

- Advertisement -