Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Register Your Component

April 3, 2000

Next, register your component with the system. Type "regsvr32 WebMail" . You should see a dialog box that announces that the component has been validly registered.

Incidentally, if you ever want to change the functionality of your component, you will have to:

  1. Change the Perl code, and the template description of your object at the end of it.
  2. do NOT change the automatically generated ID strings allocated to your component. The same object should always be referenced by the same unique ID strings.
  3. regenerate the DLL via PerlCtrl.pl -f or -d . To do so, you are going to have to first UN register the DLL containing the old COM object. To do so, type "regsvr/u WebMail".

After you have regenerated the DLL, you will need to re-register it to use it.

So, finally, let us write a brief ASP page to test our object.


<%
	option Explicit
	Dim mailer
	Dim sent

	set mailer=Server.CreateObject("WebMail.Mailer")
	sent = mailer.send(
            "[FROM]",
            "[REPLY TO ADDRESS]",
            "[TO ADDRESS]",
            "[CC ADDRESS/ES]",
            "[BCC ADDRESS/ES]",
            "[SMTP SERVER IP ADDRESS]",
            "[SUBJECT]",
            "[MESSAGE BODY]",
            "[FILE/S TO ATTACH]"
        )

	If(sent=false)Then
		Response.Write(mailer.getError())
	End If	

	If(sent=true)Then
		Response.Write("Message sent")
	End If	
%>

Bear in mind that the underlying module that is going to be performing the mailing is Mail::Sender. As a result, you can count on Mail::Sender's behavior, so that the CC and BCC addresses can be comma-separated strings.

Filenames for attachments ought to be absolute paths from root.

Running the page in your browser will send the mail according to the parameters that you have inserted in your ASP page.

Once you have grasped the fundamentals contained within this article, writing other COM objects in Perl simply comprises variations on a theme.

  1. Write your Perl code. Test that it works as pure Perl.
  2. Generate the template description of the functionality of your class via PerlCtrl.pl with the -t flag.
  3. Customize the template.
  4. Attach the template to your code, and package your code as either a freestanding or dependent COM object.
  5. Register and use the COM object you have created.

Paste the Template Code
Introduction to Perl on Windows - Table of Contents


Up to => Home / Authoring / Languages / Perl / Windows




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers