Text message via SQL Server - sql-server

We have some to critical jobs in our production system. We receiving email about of job status succeded or failed and also we want to set send text message from SQL Server. I searched but looks not so possible, has anybody tried before ?

I have done this a long time ago using a third-party tool that offers exactly what you need. You can find out more about it here.
And here you can find detailed information on how to send and receive messages from SQL Server, using this tool.
In the website it is stated that you can only use this for free for the first 30 days.
Basically you will need to host their small database on your SQL Server and then insert a row into a Messages table with the message you want to send along with the phone number to which it has to be delivered.
"The SMS Messaging Server service application will pickup any newly added messages and send them out through the appropriate channel automatically." as stated in the documentation.
However, because it is a third party tool and not open source, I don't know if it will be suitable for you. I am not aware of any free tools for the same purpose.

I have found this link where it is explained how to turn emails into text messages, it has an inconvenient, however: you have to know the cellular provider for each of the phones you want to send message.
https://www.mssqltips.com/sqlservertip/2922/sql-server-alerts-with-text-messaging-from-sql-server-database-mail/
Best regards,

Related

File created from base64 string causes memory leak on server

The company that I work for has come across a pretty significant issue with one of our releases that has brought our project to a screeching halt.
A third party application that we manage, generates word documents from base64 encoded strings stored in our SQL Server. The issue that we are having is that in some cases, when one of these documents are sent via SMTP and the file is opened by the user, the file fails to open.
When the file fails, the server locks up. The memory and cpu then grow exponentially on the server to the point that the only option is to kill the process from the server-side in order to prevent failure and down time for the rest of the users on the network.
We are using Windows 7 with Microsoft Office 2013 and the latest version of SQL Server.
What is apparent is that the word document created from the base64 string is corrupt. What isn't apparent is how this appears to bring the entire server system down in one fell swoop.
Has anyone come across this issue before and if so, what was the solution that you came up with? We do not have access to the binaries of the 3rd party application that generates the files. We aren't able to reproduce the issue manually in order to come up with a working testcase to present to the 3rd party, so we are stumped. Any ideas?
I would need more details to understand your scenario. You say this is the order of events:
1. Word file is sent via SMTP (presumably an email to an Outlook client)
2. User receives email; opens attached file
3. Memory and CPU on server go to 100 percent. This creates downtime for rest of the users.
4. Need to kill this process to recover.
Since Outlook is a client-side application, it must be the Word document attachment that is causing this problem. Can you post a sample document in a public place, like a free OneDrive account? Presumably this document creates the problem. Maybe it has some VBA code? Try this with a blank document.

What is the best method to store images in db for email sending?

Hi Im a newbie in stackoverflow!
As mentioned on the question title, I've been storing the email's image path into the db via localhost. Once the email is sent and received, my outlook automatically block the image download and I will need to manually download it (Not a big issue here).
Then I started to wonder what if my website/server is down? If it is down, the email will not be able to locate and download the image at all. So I'm wondering if there is any alternative ways to display the image without worrying bout the availability of my server.
Thanks in advance for any incoming advises/replies!
Since your primary concern seems to be about failure mitigation and not actual coding, I'll direct you to this question.
Your current method isn't actually embedding the images and is making a link. What you want to do is add the images as linked resources. This WILL make your emails larger in size and slower to send, but as long as you aren't a spammer, you should be OK.
Alternatively, you could have an enterprise level failure plan where your server would go offline and a mirrored server in a different location would begin serving up the data/images.

BizTalk 2006 - Copy a received file to a new directory

I want to be able to copy the file I have which comes in as XML into a new folder location on the server. Essentially I want to hold a back up of the input files in a new folder.
What I have done so far is try to follow what has been said on this forum post - link text
At first I tried the last method which didn't do anything (file renaming while reading). So I tried one of the other options and altered the orchestration and put a Send shape just after the Receive shape. So the same message that comes in is sent out to the logical port. I export the MSI, and I have created a Send Port in the Admin console which has been set to point to my copy location. It copies the file but it continues to create one every second. The Event Viewer also reports warnings saying "The file exists". I have set the Copy Mode of the port to 'overwrite' and 'Create New', both are not working.
I have looked on Google but nothing helps - BTW I support BizTalk but I have no idea how pipelines, ports work. So any help would be appreciated.
thanks for the quick responses.
As David has suggested I want to be able to track the message off the wire before BizTalk does any processing with it.
I have tried to the CodePlex link that Ben supplied and its points to 'Atomic-Scope's BizTalk Message Archiving Pipeline Component' which looks like my client will have to pay for. I have downloaded the trial and will see if I have any luck.
David - I agree that the orchestration should represent the business flow and making a copy of a file isn't part of the business process. I just assumed when I started tinkering around I could do it myself in the orchestration as suggested on the link I posted.
I'd also rather not rely on the BizTalk tracking within the message box database as I suppose the tracked messages will need to be pruned on a regular basis. Is that correct or am I talking nonsense?
However is there a way I can do what Atomic-Scope have done which may be cheaper?
**Hi again, I have figured it out from David's original post as indicated I also created a Send port which just has a "Filter" expression like - BTS.ReceivePortName == ReceivePortName
Thanks all**
As the post you linked to suggests there are several ways of achieving this sort of result.
The first question is: What do you need to track?
It sounds like there are two possible answers to that question in your case, which I'll address seperately.
You need to track the message as received off the wire before BizTalk touches it
This scenario often arises where you need to be able to prove that your BizTalk solution is not the source of any message corruption or degradation being seen in messages.
There are two common approaches to this:
Use a pipeline component such as the one as Ben Runchey suggests
There is another example of a pipeline component for archiving here on codebetter.com. It looks good - just be careful if you use other components, and where you place this component, that you are still following BizTalk streaming model proper practices. BizTalk pipelines are all forwardonly streaming, meaning that your stream is readonly once, and all the work on them the happens in an eventing manner.
This is a good approach, but with the following caveats:
You need to be careful about the streaming employed within the pipeline component
You are not actually tracking the on the wire message - what your pipeline actually sees is the message after it has gone through the BizTalk adapter (e.g. HTTP adapter, File etc...)
Rely upon BizTalk's out of the box tracking
BizTalk automatically persists all messages to the message box database and if you turn on BizTalk tracking you can make BizTalk keep these messages around.
The main downside here is that enabling this tracking will result in some performance degradation on your server - depending on the exact scenario, this may not be a huge hit, but it can be signifigant.
You can track the message after it has gone through the initial receive pipeline
With this approach there are two main options, to use a pure messaging send port subscribing to the receive port, to use an orchestration send port.
I personally do not like the idea of using an orchestration send port. Orchestrations are generally best used to model the business flow needed. Unless this archiving is part of the business flow as understood by standard users, it could simply confuse what does what in your solution.
The approach I tend to use is to create a messaging send port in the BizTalk admin console that subscribes to your receive port. The send port will then just use a standard BizTalk file adapter, with a pass through pipeline.
I think you should look at the Biztalk Message Archiving pipeline component. You can find it on Codeplex (http://www.codeplex.com/btsmsgarchcomp).
You will have to create a new pipeline and deploy it to your biztalk group. Then update your receive pipeline to archive the file to a location that the host this receive location is running under has access to.

How to parse emails and transfer to DB

I have seen some web apps that allow me to email stuff to a special ID and it magically turns up in my account. How exactly do they do this?
Without you giving an example of the specific service you're thinking of, it's hard to know exactly, but one way could be:
you give your email address to one of these sites, e.e. magic-mail.com
they insert this into their db, and take the db id value for this entry (12345)
they give you an address using this id (12345#magic-mail.com)
when mail is received by magic-mail.com, they look up the part before the #, pull out the associated email address for that ID, and relay the message on to the address you gave initially (toby#example.com)
There are many other ways of doing this, likely more simple than the above, but again, without examples it's hard to tell you exactly how the site you're thinking of is operating.
Edit
On reading the question, I assumed "my account" meant your mail account. If you meant an account you have on this company's system, then the process would be the same as the above, but changing the last step to:
when mail is received by magic-mail.com, they look up the part before the #, pull out the associated email address for that ID, and copy the contents of the message to the account associated with that id.
You can write a simple script on python/php or any language your know. Make it recieve a pop mail for account 'myName#mySite.com' and put the content to db.
It is quite easy.
You would need a way to monitor the mail account for new messages, read the message format, parse out the parts that are important to you and then perform the insert.
Monitoring the mail account would require having a script running on the server in a specified interval, otherwise the only other way would be to access a certain URL manually which would access the mail account and do all the necessary processing.
Depending on your hosting provider and the amount of freedom they give you, this may or may not be possible.
Short way:
You need to write a script that will connect to mail server, fetch mails, parse them and then put to database.
Run this in a cron job and you're set.

Programmatic SMS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
What is the best way to programmatically send an SMS text message?
Are there any free Web Service based SMS gateways?
I know that if I happen to know the user's carrier (Sprint, AT&T, etc), I can send an SMS by emailing an address based on phone number + carrier. I would like a good solution that does not require me to know the carrier. Barring that, is there an easy way to lookup carrier given a cell phone number?
I understand that there are some services independent of the major mobile carriers that offer a per-message fee-based service, with API. What I would like to know is how such organizations tap into the SMS networks. Do they have contracts with mobile carriers to resell their services?
Use http://www.twilio.com/
They have a REST interface to send SMS's and even to establish phone calls or receive phone calls.
You even get 30$ credits to try it out.
Def. the cheapest solution you will find.
Where I work we've been using http://www.clickatell.com for sending out SMS - it looks like its about 6 or 7 cents a message. They just take http POST requests to send out a message. I don't know if you'll be able to find any good free gateways. We used to send out emails, but found they were unreliable.
I've used clickatell in the past and found them very good also.
However, You could build your own to get messages VERY cheap. All you need is: a contract which gives loads of (or unlimited) messages; windows mobile phone; and a bit of socket programming.
Write a web service (pass the number and the message) which makes a call to a program on the mobile which sends the message.
I know of at least FTSE100 company which went this route.
We got fed up with using 'free' sms gateways, very unreliable.
Now we use an sms gateway device called OutboxSMS from Felltech Ltd. It sits on our network and hooks directly into out mobile phone provider using a wireless link from it's built-in transmitter. We needed to buy a SIM card (we got a PAYG with a huge bundle of messages), which is fitted to the OutboxSMS unit. We configured an email account for it on our mail server (MS Exchange), and configured the SMTP/POP3 account on the box.
We use OPManager, this sends alerts by email, which we direct to outboxsms, it parses the message and sends a text message to our ops guys phones when something goes wrong.
We also have some shell scripts which use sendmail to send an email to outboxsms, which again is converted to text messages.
I think this one deserves a new answer. There's a new player in town, it's called Nexmo and features highly competitive prices, even compared to Twilio.
https://www.nexmo.com/
I have been doing that with a nokia phone, connected to a linux machine. I have a cron job and a script that would check a database table for new messages and use gnokii to send messages. It works great if the number of sms you are goig to send isn't to big.
You could also get a GSM transmitter and issue AT commands that send sms's. Don't know why you would want to do it this way, but it's another option. This way you won't depend on someone else service
I don't know of any free SMS services, you usually buy bulk sms'seses and use an API to send them out.
Whitepages.com has an API that will allow developers to reverse lookup a phone number. It reports the carrier on mobile number, however a lot of the time it's some non-existent-anymore carrier like Powertel or something.
Supporting Angus, I can vouch for http://www.clickatell.com. It was used at a company I used to work at. It was a very easy solution to setup and use and worked great. You just need to anticipate how many messages you intend to send out and bulk order messages. They're pretty cheap, overall.
I have used TextMagic. They have reasonable rates and a great API and account management.
Sorry, after re-reading your question i realized this is not the answer your looking for. However this is what i did for my command line program. There's a website where if you put in the telephone number it gives you the carrier. So when i entered my number it screen scraped the website, got the carrier and if the carrier is in my list, i retrieved the email of that carrier
Most companies offer a SMS-to-email kinda thing. For example myphonenumber#verizon.com or something (there's a whole list on wikipedia).
I used that to create my self a little command line application in c# that sends out text messages. However, you don't really get a "reply" and the number is a pre-assigned one from the company.
I think if you want to go the free route, this is your best bet.
Here's the wikipedia link:
SMS gateway

Resources