Yesterday, I didn’t have much work to do, so I decided to surf the net to find something interesting. And while I was reading some blogs at mvblogs.org I found a PHP script written by jaa, which sends web sms using the Dhiraagu’s web server. I don’t know much about PHP, but I wanted to write a similar script using ASP vbscript, the language that I have been using for the past 3 years. But due to the limitations in ASP vbscript I decided to move to ASP VB.NET to do the server-side scripting. (in classic ASP, http web request cannot be made without using a third-party component like AspHttp) In ASP VB.NET, the methods were much simpler than I thought. But it took about 5 hours of non-stop programming to complete the server-side part. In general, what this script does is, it passes the login information to the perl-script hosted at dhiraagu server, and when the user is authenticated, the perl-script sets a cookie named “Dhi” which has a value like ‘0653233’. After grabbing the cookie value from that page, the second request is made to the “send_message.pl” to send the message. I have also added some additional functionality to script, which will display the remaining SMS for the day and all validations are made on server-side. AJAX (Asynchronous Javascript And XML) is used to supply the form fields with required parameters. I will release the source code for the script after ‘beautifying’ and commenting the code blocks. |
Official web blog of Ahmed Naxim, where you can find some of my ongoing projects in web-development and windows applications (C# .NET, VB .NET, PHP, Java, Objective-C and WPF)
Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts
Sunday, December 3, 2006
Dhiraagu Web SMS widget using ASP VB.NET and AJAX
Tuesday, November 14, 2006
How to send Arabic email using CDOSYS in classic ASP
I have been trying this for a couple of weeks now and last night i have found a way that it could be done quite easily in classic ASP. Sending emails using the SMTP server in windows is quite easy, however i have been trying to do this for a client where he needs to send emails from the website using arabic characters when users make reservations from the website. After completing this page using a typical ASP page, i figured out that the arabic characters are displayed as ????? (question marks)..
As usual, i tried to solve this problem by searching the google to find a solution for this. I found that many people have faced the same problem as me, but couldn't find a solution. Then i tried to search the Microsoft website to find the members of the "CDO.Message" object. And finally i figured out that there is a property to change the charset of the message body.. and when i changed this charset to "utf-8" it worked!!
Here's the source code of the ASP file, so that anyone who faces this problem might find this useful..
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
cdoConfig.Fields.Update
set cdoMessage.Configuration = cdoConfig
cdoMessage.BodyPart.Charset = "utf-8"
cdoMessage.From = "from@mail.com"
cdoMessage.To = "recipients@mail.com"
cdoMessage.Subject = "Arabic Email usin SMTP - CDOSYS"
cdoMessage.HtmlBody = "مرحبا بك فى المالديف"
cdoMessage.Send
set cdoMessage = Nothing
set cdoConfig = Nothing
As usual, i tried to solve this problem by searching the google to find a solution for this. I found that many people have faced the same problem as me, but couldn't find a solution. Then i tried to search the Microsoft website to find the members of the "CDO.Message" object. And finally i figured out that there is a property to change the charset of the message body.. and when i changed this charset to "utf-8" it worked!!
Here's the source code of the ASP file, so that anyone who faces this problem might find this useful..
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
cdoConfig.Fields.Update
set cdoMessage.Configuration = cdoConfig
cdoMessage.BodyPart.Charset = "utf-8"
cdoMessage.From = "from@mail.com"
cdoMessage.To = "recipients@mail.com"
cdoMessage.Subject = "Arabic Email usin SMTP - CDOSYS"
cdoMessage.HtmlBody = "مرحبا بك فى المالديف"
cdoMessage.Send
set cdoMessage = Nothing
set cdoConfig = Nothing
Labels:
arabic,
arabic email,
asp,
cdosys,
send email,
smtp
Subscribe to:
Posts (Atom)