Add Hmail Server to mail components

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/69737?pagenum=1
04 November 2025, 21:39

Topic


Art
Add Hmail Server to mail components
07 November 2010, 12:28


Hello all!
I am running Hmail Server on WinServ2003. One forum (set up years ago) is using (I believe) cdosys to send messages. Another forum needs mail service now, and I would like to add Hmailserver to the list. Should I try to get cdosys to send the mail for this forum (with which I am possibly having issues), or can I add code for hmailserver to do the job?
I'll start with some sample code from inc_mail:
Code:
case "jmail"
Set objNewMail = Server.CreateObject("Jmail.smtpmail")
objNewMail.ServerAddress = strMailServer
objNewMail.AddRecipient strRecipients
objNewMail.Sender = strSender
objNewMail.Subject = strSubject
objNewMail.body = strMessage
objNewMail.priority = 3
on error resume next '## Ignore Errors
objNewMail.execute
If Err <> 0 Then
Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Err.Description & "</li>"
End if

Now an example components list from admin_config_email (with the string HmailServer instead of "jmail" or the like:
Code:
	'## the components

theComponent(13) = "HmailServer"


'## the name of the components

theComponentName(13) = "HmailServer"



'## the value of the components


theComponentValue(13) = "HmailServer"

Can anyone point me in the right direction for altering this code to fulfill the requirements for hmailserver, as well as identifying other bits of code that may be involved?

 

Replies ...


Davio
07 November 2010, 21:51


Don't have my code tools in front of me to write the exact code for you, but if anyone wants to help you out, here is a sample script to send a message with hmail using the Message api: http://www.hmailserver.com/documentation/v5.3/?page=com_example_message_send

Here are the details on the Message object: http://www.hmailserver.com/documentation/v5.3/?page=com_object_message
Davio
11 November 2010, 10:49


Ok, since no one else stepped in, here is the code you would put in inc_mail.asp. After line 356 (right before the "end select") paste this bit of code:
Code:
case "hmail"
Set objNewMail = CreateObject("hMailServer.Message")
objNewMail.From = strFromName
objNewMail.FromAddress = strSender
objNewMail.AddRecipient strRecipientsName, strRecipients
objNewMail.Subject = strSubject
objNewMail.Body = strMessage
on error resume next '## Ignore Errors
objNewMail.Save
If Err <> 0 Then
Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Err.Description & "</li>"
End if

In admin_config_email.asp, change lines 100 - 102 to this (increasing the 20 to 21):
Code:
Dim theComponent(21)
Dim theComponentName(21)
Dim theComponentValue(21)

After line 125, add the code in red:
Code:
theComponent(20) = "VSEmail.SMTPSendMail"
theComponent(21) = "hMailServer.Message"

After line 148, add the code in red:
Code:
theComponentName(20) = "VSEmail"
theComponentName(21) = "hMailServer"

After line 171, add the code in red:
Code:
theComponentValue(20) = "vsemail"
theComponentValue(21) = "hmail"

That's it. Test it and let me know if it works.
Art
13 November 2010, 17:29


Thanks Davio!
I have been out at sea for a few days, so I have not been able to check in.
I will edit the code (and certainly check out these links).
I hate not knowing code and structure of .asp, php, or even much HTML. I am so lost, I wasn't even sure that "theComponent" was an array. Apparently, arrays in .asp use () instead of [].
Art
13 November 2010, 17:42


Hmmm.
Well, I patched in the code, and for whatever reason when in the email config screen in the forum I only have CDOSYS (IIS 5/5.5/6) that shows up. Any hints as to why?
Davio
13 November 2010, 22:24


Hmm, maybe the code isn't correct.
Just had a quick chat with a dev on their IRC channel. He said the examples aren't accurate and need updating, and that I need to authenticate before I call the COM API.
I'm going to download and install hMail and test it locally. Quicker to help you that way.
Art
14 November 2010, 01:28


Wow,
Thanks Davio.
I guess I help folks out a lot on any number of things, including boat systems as well as C++ and GML, but that doesn't make me appreciate someone else helping me out any less. You are seriously going out of your way here, and if this wasn't important or if I thought I was capable of solving this issue in a reasonable amount of time, I wouldn't waste your time. This is for a non-profit 501c (Adoption Related Services of Pinellas http://arsponline.org ). They are a mental health counseling program for foster and post adoption kids and families that have some serious issues. I am the volunteer sys-admin. They don't exactly have a lot of disposable income, and have a huge admin load. I have set up OPENEMR as a Mental Health Record system, and I am hosting a mail server and their website. I have been writing some little applications for them, building office furniture, painting, plumbing, taking care of computers, networks, lost files, and ridding them of infestations of ants and bats. It's a little overwhelming. I have also had to scan and import about 4 filing cabinets worth of records and putting them into the EMR. I am hoping that they can use the Forum as a Policy and Procedure/document download gateway for admin use, and get any other utility for them out of it I can. I really wish I could set up a PM system, but I have noticed that not many of the mods I have tried to implement for Snitz have worked for my own little fan forum (http://starfrontiers.org). Some folks have had issues with the mail server from time to time for which I have had to do work-arounds (ISP's blocking port 25, silly folks sending huge encrypted file containers, folks unable to set up their own accounts on their mail client etc...), and a sort of web-mail setup might be really nice for them. I am just trying to get some real tools and databases available for these folks. One of them happens to be my wife. Since they all have very expensive educations, are totally dedicated, and make almost no money, they all tend to put in something like 14+ hours a day, including weekends. Anything I can do to network them better will lighten that load. They are literally killing themselves. I know they are masochists, but, well, as I said: One of them is my wife.
Thanks again Davio.
Davio
14 November 2010, 17:07


Hey Art, it's not a problem. It's the norm here. smile
I installed and got hmail up and running along with IIS 7. I am using Windows 7 Professional x64. After doing some testing I realized the hMail component was giving a permission denied error, as is posted here on the hmail forums: http://www.hmailserver.com/forum/viewtopic.php?f=9&t=13820

It doesn't show up in your pages because we make sure to hide the errors quietly and continue loading the page.
After I followed the advice of the last poster in that thread, it fixed the error and was able to use hmail to send emails.
Which operating system are you running hMail on? Try the fix posted by jwadew:
Start, Run dcomcnfg. Expand Component Services, Computers, My Computer and DCOM Config. Right-click hmailserver, select the Security tab. Under Launch and Activation Permissions, click the Edit button.
If you do not see the Internet Guest Account, then add that:
Click the Add button, then the Advanced button, then the Find Now button. Scroll down to a user starting with IUSR_, select it, then click Ok
Continue to next step below...
If you do see the Internet Guest Account, then make sure that Local Launch and Local Activation rights are checked.
Art
17 November 2010, 06:15


Windows Server 2003

I will make sure to check the IUSER permissions for hmail. Immediately.
Davio
17 November 2010, 08:36


Ok. Then if that doesn't work, will have to give you a file that will check if there is an error. But let me know if you get any where with the previous suggestion.
Art
17 November 2010, 09:37


Darn. Still just CDOSYS showing up for e-mail components.
Art
17 November 2010, 17:34


W00T! Davio got it! Permissions issue (unknown by me as to exactly what).
Davio
17 November 2010, 18:54


I did the same thing in the link I posted before on the hmail forum. Opening the DCOM Configuration window, searching for hmailserver component, right clicking to open properties, security tab, and giving the IUSR_ account permission to launch the component.
Art
17 November 2010, 20:24


Oh, I thought I gave it rights. I guess all I did was give it read/write, not execute. DOH!! Of course it has to have execute rights....pretty dumb on my part.
Davio
17 November 2010, 21:33


Maybe you were in the wrong place.
You go to Start >> Run.. >> type in "dcomcnfg" and press enter
OR
My Computer >> Control Panel >> Administrative Tools >> Component Services

In the window, as shown below, double click on Component Services, Computers, My Computer. Click on DCOM Config and right click on hMailServer, to get to Properties. [IMG]http://img844.imageshack.us/img844/3848/services.png[/IMG]

In the Properties window, click the Security tab, then the Edit button in the Launch and Activation Permissions section as shown below. I gave the IUSR_ account (the internet guest user) permission to launch locally. [IMG]http://img26.imageshack.us/img26/6230/hmail.png[/IMG]
So not sure where you went to give read/write. hehe Might want to undo it.
Art
18 November 2010, 11:07



Thought you were talking about here. (example from my workstation)

Traverse/Execute permissions after granting IUSER access.
Davio
18 November 2010, 11:27


Oh so you gave hmail executable read write? :)
Make sure you undo it so we won't open up any security holes any where. smile
Art
18 November 2010, 18:14


Right-o on my way...
© 2000-2021 Snitz™ Communications