Sending automatic email with php

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
sid17
New user
New user
Posts: 2
Joined: 2016-07-12 02:30

Sending automatic email with php

Post by sid17 » 2016-07-12 02:35

Is it possible to use mail() to send mail automated mail with hmail server?

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Sending automatic email with php

Post by percepts » 2016-07-12 04:10

yes but...

the php mail() function on windows has no ability to authenticate the sender so its normally better to use a PHP Mailer class which can autheticate and do much more besides.

Take a look at:

https://github.com/PHPMailer/PHPMailer

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Sending automatic email with php

Post by percepts » 2016-07-12 17:32

Also read all of following topic which details two methods of initiating PHP scripts from hmail depending on whether PHP is installed on same machine as hmailserver or on an external server which requires initiating php via http request.

viewtopic.php?f=9&t=27212&hilit=php.exe

sid17
New user
New user
Posts: 2
Joined: 2016-07-12 02:30

Re: Sending automatic email with php

Post by sid17 » 2016-07-12 23:02

How can I get a PHP script to send an email using hmail server for confirmation type emails?

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Sending automatic email with php

Post by percepts » 2016-07-12 23:17

You need to be far more explicit. If you are asking what is the PHP code to send an email then go to a PHP help forum and ask there.
The link I gave you tells you how to execute a PHP script from hmail so I don't really know what you are asking.

confirmation of what? Some event I guess but I have no clue what event you are talking about or where the event is happening. In hmail or somewhere else? If its somewhere else then its not an hmail support question.

A PHP script is the same as an email client so php has to specify the email account user, password and server just like any email client does. But that is a PHP question and not hmail support question. So what exactly are you trying to do and what is the event you are trying to handle?

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Sending automatic email with php

Post by percepts » 2016-07-12 23:29

what you should know is that hmail has a script API call the "Com API". You can use this via the "eventhandlers.vbs". You need to enable scripting in your hmail settings and then you can edit the eventhandlers.vbs file to perform your own vbs code at certain hmail events.

You must read the hmail documentation especially the com api section and how to use the eventhandlers.vbs script.

Then you can add fuctionality to execute a php script from the eventhandlers.vbs file when your chosen hmail event occurs.

You can send an email directly from the eventhandlers.vbs file without using php.

See: https://www.hmailserver.com/documentati ... m_examples "sending a message"

But you will need your own vbs code to trap the specific event you want to confirm.

But if you are just trying to send a confirmation message from a website page then the PHPMailer class I gave you a link to will do it without needing any eventhandler.vbs code.

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Sending automatic email with php

Post by percepts » 2016-07-13 18:08

I should have asked before but are you running PHP on a unix or windows webserver. If its a unix webserver then php mail() function could well be using sendmail which does allow you to authenticate using the php mail() function. Its usually only windows webservers that you can't authenticate using php mail() function. So on a unix webserver you wouldn't necessarily need to use the PHPMailer class I pointed you at although you could if you wanted to.

Post Reply