Create EML files from PHP mail function

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Create EML files from PHP mail function

Postby trymeout » 24. October 2020 02:39

I was able to do this on Linux by setting the sendmail_from and sendmail_path to...

Code: Select all
sendmail_from = noreply@localhost.com

sendmail_path = "cat > /home/john/Documents/XAMPP\ Emails/`date '+%Y-%m-%d - %H-%M-%S'`.eml"



And this will create EML files and have then saved in my Documents\XAMPP Emails\ folder and they will be named by the date and time they are created. How would one do this on Windows? I cannot convert the sendmail_path to execute on Windows since the command to my understanding is for Linux computers.
trymeout
 
Posts: 16
Joined: 20. March 2018 16:02
XAMPP version: 3.3.2
Operating System: Windows 10

Re: Create EML files from PHP mail function

Postby Nobbie » 24. October 2020 11:30

trymeout wrote:I cannot convert the sendmail_path to execute on Windows since the command to my understanding is for Linux computers.


You can try to install Cygwin for Windows, which is a Linux Command Environment for Windows. Eventually you have to change some parts of the command, i dont know if Cygwin supports the "date" command and i dont know if it supports the "backticks" which used to execute the date command in that line.

Actually, it would be easier simply to run Xampp on Linux instead. Either on an appropriate PC (any cheap second hand PC from Ebay will do the job, not more than 50$ needed), or install a VirtualBox onto your PC and run a Linux machine on VirtualBox.

P.S.: On Github i found this Windows workaround, maybe its exactly what you need. I did not check it: https://gist.github.com/tomasfejfar/0f7 ... 8b38a9ad31
Nobbie
 
Posts: 13214
Joined: 09. March 2008 13:04

Re: Create EML files from PHP mail function

Postby Altrea » 24. October 2020 16:06

In XAMPP for Windows there is included xampp mailtodisk which does something similar. It will not create eml files but txt files and save them to disk.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11952
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Create EML files from PHP mail function

Postby trymeout » 24. October 2020 18:34

How would one configure mailtodisk to create eml files named by their creation date to be saved in a specific directory? This looks like the thing I am looking for.
trymeout
 
Posts: 16
Joined: 20. March 2018 16:02
XAMPP version: 3.3.2
Operating System: Windows 10

Re: Create EML files from PHP mail function

Postby Altrea » 24. October 2020 22:01

I don't know if eml files does have specific requirements about the structure. But if the difference is only the file extension you could try to change the Sourcecode of this little program which you can find in the src folder and recompile the new version.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11952
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Create EML files from PHP mail function

Postby Nobbie » 25. October 2020 11:13

I strongly recommend to check out the github link i applied above.
Nobbie
 
Posts: 13214
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 146 guests