Add Hmail Server to mail components - Posted (5791 Views)
Starting Member
Art
Posts: 32
32
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?
http:\\StarFrontiers.org
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Development Team Member
Davio
Posts: 12217
12217
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
Posted
Development Team Member
Davio
Posts: 12217
12217
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.
Posted
Starting Member
Art
Posts: 32
32
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 [].
http:\\StarFrontiers.org
Posted
Starting Member
Art
Posts: 32
32
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?
http:\\StarFrontiers.org
Posted
Development Team Member
Davio
Posts: 12217
12217
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.
Posted
Starting Member
Art
Posts: 32
32
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.
http:\\StarFrontiers.org
Posted
Development Team Member
Davio
Posts: 12217
12217
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.
Posted
Starting Member
Art
Posts: 32
32
Windows Server 2003

I will make sure to check the IUSER permissions for hmail. Immediately.
http:\\StarFrontiers.org
Posted
Development Team Member
Davio
Posts: 12217
12217
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.
Posted
Starting Member
Art
Posts: 32
32
Darn. Still just CDOSYS showing up for e-mail components.
http:\\StarFrontiers.org
You Must enter a message