Web Hosting, Linux Hosting, Windows Hosting Provider  
Windows Hosting Linux Hosting VPS Hosting JSP Hosting E-Mail Hosting Reseller Hosting Support Contact Us

Archive for Computer Technical Support

ASP Email – CDOSYS

We start by creating a mail object and a configuration object to use with it:

<%
  Set oCdoMail = Server.CreateObject("CDO.Message")
  Set oCdoConf = Server.CreateObject("CDO.Configuration")
%>

Set the ZetaClear
configuration object up as shown below. You might have to change the SMTP server item from "localhost" to point to your web hosts SMTP server. The default port is 25, which you may also have to change - again, check with your web host.

<%
  sConfURL = "http://schemas.microsoft.com/cdo/configuration/"
  with oCdoConf
    .Fields.Item(sConfURL & "sendusing") = 2
    .Fields.Item(sConfURL & "smtpserver") = "localhost"
    .Fields.Item(sConfURL & "smtpserverport") = 25
    .Fields.Update
  end with
%>

Now we can set up our recipients. You can send to multiple recipients by seperating addresses with a semicolon, as shown with the To property below:

<%
  with oCdoMail
    .From = "you@yourdomain.com"
    .To = "someone@domain.com; somebody@domain.com"
    .CC = "someone.else@domain.com"
    .BCC = "someone@anotherdomain.com"
  end with
%>

Set the Subject and Body text and we're almost there. To send plain text email, use the TextBody method. To send HTML email, use the HTMLBody method.

You can also add an attachment to your message by using the AddAttachment method:

<%
  with oCdoMail
    .Subject = "My message subject"
    .TextBody = "This is a plain text email"
    .HTMLBody = "<b>This is an HTML email</b>"
    .AddAttachment = "C:\Inetpub\wwwroot\attachment.zip"
  end with
%>

And that's just about it, all we need to do now is bind the configuration to the CDO Message and send the email:

<%
  oCdoMail.Configuration = oCdoConf
  oCdoMail.Send
  Set oCdoConf = Nothing
  Set oCdoMail = Nothing
%>

Don't forget to destroy the configuration and mail objects we've used.

Comments

Sending email using CDOSYS

If you are using a Windows 2000 / 2003 Server, or even XP Pro chances are that CDOSYS is your best bet for sending email from Active Server Pages. That is because CDOSYS is installed on all of them by default. Gone are the days of using CDONTS which was the old way of sending email from ASP. CDOSYS is it’s replacement.

That being said there are actually a lot of ways to configure and use CDOSYS. When I 1st started using CDOSYS I assumed the CDOSYS code I was using would work in any situation, but that is not the case. This is something most articles about CDOSYS do not mention so I am going to show you 3 different CDOSYS examples each sending email using a slightly different method.

  1. Method 1 involves sending email using a local pickup directory. Meaning you have the IIS SMTP Virtual Server Running. If you are on a local development machine this is probably for you. Under this scenario any emails you send from your scripts put a “.eml” file in the local pickup directory. Then hopefully the SMTP Virtual Server grabs the file and sends it off. The Virtual SMTP server is however known to hiccup and not send out the emails right away.
  2. Method 2 involves port forwarding. I am not exactly sure how you set that up on the server but the code I wrote for it works under that scenario. The hosting company known as Verio actually implements this with CDOSYS on their servers. I actually implemented this method in some of my software because of a customer that couldn’t get emails to send on one of their servers.
  3. Method 3 involves sending the email using a remote mail server. This supports outgoing SMTP authentication should your server require that for outgoing emails. Many do these days. This method is also the best method to use because you are using a real email server with valid MX records. Many modern email systems block emails that do not have valid MX records and you want your emails to reach the recipients.

Method 1 ( Local Pickup Directory where server is running SMTP Virtual Server )

<%
Dim ObjSendMail
Dim iConf
Dim Flds

Set ObjSendMail = Server.CreateObject(”CDO.Message”)
Set iConf = CreateObject(”CDO.Configuration”)
Set Flds = iConf.Fields

Flds(”http://schemas.microsoft.com/cdo/configuration/sendusing”) = 1

‘**** Path below may need to be changed if it is not correct
Flds(”http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory”) = “c:\inetpub\mailroot\pickup”
Flds.Update

Set ObjSendMail.Configuration = iConf
ObjSendMail.To = “someone@someone.net
ObjSendMail.Subject = “this is the subject
ObjSendMail.From = “someone@someone.net

‘ we are sending a text email.. simply switch the comments around to send an html email instead
‘ObjSendMail.HTMLBody = “this is the body
ObjSendMail.TextBody = “this is the body

ObjSendMail.Send

Set ObjSendMail = Nothing
%>

Method 2 ( Using mail forwarding on port 25 )
Include this metatype library code on the page you use this emailing with code because there are some things in it this method needs. You can probably get rid of these two lines if you figure out what it references but I didn’t take the time to look.

<!–METADATA TYPE=”typelib” UUID=”CD000000-8B95-11D1-82DB-00C04FB1625D” NAME=”CDO for Windows Library” –>
<!–METADATA TYPE=”typelib” UUID=”00000205-0000-0010-8000-00AA006D2EA4″ NAME=”ADODB Type Library” –>

<%
Dim ObjSendMail
Dim iConf
Dim Flds

Set ObjSendMail = Server.CreateObject(”CDO.Message”)
Set iConf = Server.CreateObject(”CDO.Configuration”)

Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = 2
.Item(cdoSMTPServer) = “mail-fwd”
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
End With

Set ObjSendMail.Configuration = iConf

Set ObjSendMail.Configuration = iConf
ObjSendMail.To = “someone@someone.net
ObjSendMail.Subject = “this is the subject
ObjSendMail.From = “someone@someone.net

‘ we are sending a text email.. simply switch the comments around to send an html email instead
‘ObjSendMail.HTMLBody = “this is the body
ObjSendMail.TextBody = “this is the body

ObjSendMail.Send

Set ObjSendMail = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>

Method 3 ( Using remote mail server )

<%
Dim ObjSendMail
Set ObjSendMail = CreateObject(”CDO.Message”)

‘This section provides the configuration information for the remote SMTP server.

ObjSendMail.Configuration.Fields.Item (”http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2 ‘Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item (”http://schemas.microsoft.com/cdo/configuration/smtpserver”) =”mail.yoursite.com
ObjSendMail.Configuration.Fields.Item (”http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25
ObjSendMail.Configuration.Fields.Item (”http://schemas.microsoft.com/cdo/configuration/smtpusessl”) = False ‘Use SSL for the nail fungus
connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="somemail@yourserver.com"
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="yourpassword"

ObjSendMail.Configuration.Fields.Update

'End remote SMTP server configuration section==

ObjSendMail.To = "someone@someone.net"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "someone@someone.net"

' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"

ObjSendMail.Send

Set ObjSendMail = Nothing
%>

In addition to what you see here there are plenty of properties you can add to these examples.
Here are a few examples.

Carbon Copy
ObjSendMail.CC = "someone@someone.net"

Blind Carbon Copy
ObjSendMail.BCC = "someone@someone.net"

Send Attachment (we hard code it here, but you could specify the file path using Server.Mappath as well)
ObjSendMail
.AddAttachment "c:\myweb\somefile.jpg"

and a ton of other things you can do...

Comments

How to block a website on your computer.

If you would like to block a website from being viewed on your Windows computer, follow these steps:

C:\WINDOWS\system32\drivers\etc

First backup the hosts file.

Open hosts file there from the does zetaclear really work
notepad.

At the end of the line you can see as per below.

127.0.0.1 localhost

Append the following line at the end

127.0.0.1 BlockSitename.com # replace the BlockSitename.com with the site name that you want to block.

then go to Start->Run-> type ipconfig /flushdns

Enjoy…

Note: That will only stop the domain name to go to the website but if you know the IP address of the site from dnsstuff or whois then you can browse the site.

Comments


find hidden objects