Create or import a new email from command line

Hello,

Is there a way to create or import a new mail using the command line (bash, php…) ?

I want to create and deliver campaigns automatically. I would take some data from mysql, create a mail, import this mail into phplist and then deliver it with the phplist command line.

Thanks in advance.

@lince There is limited support for sending a message from the command line.
See the file docs/README.commandline that is in the phplist zip file.

Thank you for your reply.

I checked the command line options and I could not find any command to create or import a new mail, this is why I am asking. See i there is ant hidden/custom way to do it.

This is explained in the README file

phplist -psend

This will require some more arguments:

-l list
-s subject
[-f from]

and you need to "pipe" the message into the script.

One other way is to use the rest api plugin but that would involve some php development, see https://resources.phplist.com/plugin/restapi

I thought the -psend worked only to send to one destination, it looks like I missed the “-l list” parameter.

Also the rest api sounds like a very good option. I was waiting for an chance to start working with APIs so this could be a good time to start.

Thanks a lot :smile: