Send Email from SQl Database
This is a great blog post regarding how to setup SQL Mail. Need to keep for reference.
This is a great blog post regarding how to setup SQL Mail. Need to keep for reference.
The Exchange server is primarily responsible for the broadcast of e-mails generated within SyteLine .
An Exchange server is a Microsoft messaging system including mail server, email client and groupware applications. If e-mails are not being generated from SyteLine, for example when a purchase order is printed, then there are certain procedures to follow to establish where the error lies.
The first thing to check is the Exchange server itself.
Sign onto the utility server as administrator (sign into the domain and not the local machine)
Go to start-run-cmd
Try to ping the Exchange server (or whatever is running SMTP)
SMTP (Simple Mail Transfer Protocol) is a TCP/IP protocol used in sending and receiving e-mail.
This will return the IP address if all works okay.
Then type :
Telnet IP-address of exchange server 25
(Note that the 25 is the open port number)
Then type :
Helo (This command is used to identify the sender (client) to the SMTP server use: ehlo if helo does not work.)
Then type :
Mail to:<e-mail address> press enter
(this e-mail address should be the ?SMTP from e-mail? on the intranets form)
Then type :
Rcpt to:< e-mail address> press enter
Then type :
Data
Then type your e-mail message
Once finished with your e-mail message body, then on a new line place a full stop.
NEXT you need to check that ‘RELAY’ is switched on, on the exchange server.
To do this , on the exchange server go to
system manager
admin groups
1st admin
Servers
Protocols
SMTP
Then right click on the exchange server name.
Go the the ‘Access’ tab
Into relay and then add.
Then go into SyteLine and into the vendor document profile
Set up a profile for the vendor and the destination e-mail address.
Ensure the vendor document profile is set to active.
Below is a pretty useful Form Script Function that can be used to send out email. You can trigger this by any event.
PublicSub SendEmail()
Dim EmailBody AsString
Dim toAddress AsNew Net.Mail.MailAddress(ThisForm.PrimaryIDOCollection .GetCurrentObjectProperty("your_email_field"))
Dim FromAddress AsNew Net.Mail.MailAddress("me@company.com", "Display Name")
EmailBody = "Some text:" & ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("some_property") & vbNewLine _
& "Some more stuff: " & vbNewLine & ThisForm.PrimaryIDOCollection.GetCurrentObjectProp erty("description")
Dim msg AsNew Net.Mail.MailMessage(FromAddress, toAddress)
msg.Body = EmailBody
msg.IsBodyHtml = False
msg.Subject = "Some subject:" & ThisForm.PrimaryIDOCollection.GetCurrentObjectProp erty("some_property")
Try
Dim mySmtp AsNew Net.Mail.SmtpClient("IP address of your SMPT server")
mySmtp.Send(msg)
Catch ex As Exception
MsgBox(ex.Message)
End Try
EndSub
Recent Comments