Seiden Group
Modern Development & Open Source for IBM i
  • Link to LinkedIn
  • Link to Mail
  • Home
  • Seiden PHP+
    • Seiden PHP+
    • Install & Learn
    • SmartSupport
    • PHP Migrations & Upgrades
    • Success Stories
    • Free PHP Assessment
    • Documentation
    • What’s New (Changelog)
  • IBM i Services
    • Development
    • Training & Mentoring
    • Open Source Setup & Upgrades
    • SSL/TLS Install & Learn
    • Performance
  • Support
    • Open Source & PHP
    • VS Code for i
    • Developer Support
    • Support Success Stories
  • VS Code for i
    • Support
    • Training
    • Code for i Resource Guide
    • Getting Started Videos
    • Code for IBM i Fridays
  • Free Stuff
    • IBM i Strategy & Tips
    • PHP Upgrade Assessment
    • CNX Valence Assessment
    • VS Code for IBM i Resources
    • Code for IBM i Fridays
    • QCachegrind Download
    • PHP Toolkit for IBM i Resources
    • Qshell on i Library
  • Blog
  • About
    • About Our Team
    • About Alan Seiden
    • Speakers & Sessions
    • In the News
  • Contact
  • 201.447.2437
  • Search
  • Menu Menu

Seiden Group Blog

Sending Email from PHP on IBM i

January 15, 2021/0 Comments/in PHP /by Calvin Buckley

With reliable email functionality being one of the top concerns of IBM i PHP users, we’ve made sure that Seiden PHP+ includes everything you need to send email. The PHP mail() function works well, as do components such as Zend\Mail and PHPMailer.

Over the past couple of years, we’ve been hearing from disappointed PHP users that mail() didn’t work in other community PHP distributions (and some builds of Zend Server). PHP mail() requires an external program that implements the sendmail interface. If your PHP distribution lacked sendmail or equivalent, you might have received a cryptic error message such as:

1
sh: -t:  not found

This article discusses your options for sending email using Seiden PHP+.

Classic mail() function

Although the mail() function has limitations, it is popular, so we support it. Our Seiden PHP+ distribution provides this underlying email capability by including an open source, sendmail-compatible email program called msmtp.

The msmtp program empowers your mail() function to send email over SMTP. Here is our documentation on how to set it up. To summarize: After you have installed Seiden PHP+, create a configuration file that defines your SMTP server. For example, substitute your mail server’s settings into the template below, and save it at /QOpenSys/etc/msmtprc.

1
2
3
4
5
6
7
8
9
10
11
defaults
auth on
tls on
logfile /QOpenSys/var/log/msmtp.log
account example
host smtp.example.com
port 587
from foo@example.com
user youruser
password yourpw
account default : example

Once that’s in place, mail() will use msmtp, which uses that configuration file, and you’re ready to go! If you run into any issues, check our documentation on setting up mail() for Seiden PHP.

You are not limited to using mail(). Below are our recommendations for more powerful, versatile mail options.

PHPMailer

If you’re willing to take on an additional package, we recommend PHPMailer as an alternative. It’s flexible and handles many use cases that the built-in mail() function does not. For example, it provides many things that would be impossible or difficult using just mail(), including UTF-8 support, attachments, and validation against bad inputs.

PHPMailer is a popular library used by many PHP projects, including major ones like WordPress. You can rely on it being a trusted, robust piece of software. If you’re using Composer like most modern PHP projects, then just run the following command to install it:

1
composer require phpmailer/phpmailer

Laminas, Zend Framework, Laravel, and other PHP frameworks

The mail components of these frameworks are another popular option for sending mail. If you’re using these frameworks, then you likely have all the pieces you need.

It’s worth noting you can use Zend Framework without Zend Server. Zend Framework is a separate open-source project, that can be used independent of any PHP distribution.

Email Your Way

Whether you use mail(), PHPMailer, Zend\Mail, or other popular email components, Seiden PHP+ will support your choice. To learn more, get in touch for a free PHP upgrade consultation or to discuss letting our developers help you complete your next project.

Tags: AS/400, email, IBMi, iSeries, mail, PHP, phpmailer, SeidenPHP, System i, Zend Framework
Share this entry
  • Share on Facebook
  • Share on X
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Reddit
  • Share by Mail
https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png 0 0 Calvin Buckley https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png Calvin Buckley2021-01-15 16:27:592025-12-15 12:25:57Sending Email from PHP on IBM i
Calvin Buckley

About Calvin Buckley

Recognized as an IBM Champion and a 2020 Fresh Face of IBM i, Calvin exhibits remarkable talent for expanding the use of IBM i through open ...Read More

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

SUBSCRIBE
Open Thinking
Monthly IBM i Strategy & Tips
  • This field is for validation purposes and should be left unchanged.

IBM i Development

  • RPG, COBOL, SQL, Node,
    PHP, Python, Valance, etc.
  • Modernization. Integration.
  • Web and API Solutions
  • Legacy Maintenance
    ...
LET'S GET IT DONE!

Recent Posts

  • Mitigating the eMudhra Intermediate CA Compromise with IBM i
  • Critical php2shell Security Update Available in Seiden PHP+ Server
  • Moving to IBM i 7.6? An SDA Alternative with VS Code and IBM Bob
  • What’s New with Mapepire Database Connector for IBM i
  • Do You Need IBM i Observability?
  • PHP 8.6 is Coming Soon to IBM i
  • Safer npm installation is on the way for Node.js (and all JavaScript)
  • Access Modern Security for IBM i and Connected Web Environments
  • IBM i: A Natural Platform for Agentic AI
  • PHP on IBM i in 2026: The Modernization Engine

SEIDEN GROUP: Modern Development & Open Source for IBM i

Home   |   Seiden PHP+   |   IBM i Services  |   Support   |   VS Code for i   |   Free Stuff   |   Blog  |   Privacy Policy  |   Contact         201.447.2437

© 2026 Seiden Group, LLC
  • Link to LinkedIn
  • Link to Mail
Link to: Welcome Back, MariaDB! Link to: Welcome Back, MariaDB! Welcome Back, MariaDB! Link to: Free QCachegrind Enables Application Profiling for PHP Developers Link to: Free QCachegrind Enables Application Profiling for PHP Developers Free QCachegrind Enables Application Profiling for PHP Developers
Scroll to top Scroll to top Scroll to top