Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 994647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:36:23+00:00 2026-05-16T06:36:23+00:00

I use mstmp to send mail from various smtp account. Using PHP’s mail command

  • 0

I use mstmp to send mail from various smtp account. Using PHP’s mail command it sucessfull sends mail from mstmp using the default account.

However, I want it to let me specify which smtp account to send from. Using mstmp you do that with the following command: msmtp –account=svh where svh is the smtp account you name. More on msmtp can be found here: msmtp sourceforce

So what are my options, is there a modified mail command that will let me use msmtp using the –account parameter ? Should i just run a shell command with root privilege (don’t want to do that).

How would you tackle this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:36:23+00:00Added an answer on May 16, 2026 at 6:36 am

    Looks like msmtp has a way where you can define a config to be system wide so www-data can actually run the command and have the emails I need. Love msmtp.

    Edit: Here is my quick and dirty function to do what I wanted, incase someone needs this later. I highly suggest you do more error-checking.

    function msmtp($To, $Subject, $Body, $Headers, $Account) {
        $Email = "To: $To\nSubject: $Subject\n$Headers\n\n$Body\n";
        exec("echo '$Email' | msmtp --account=$Account $To");
    }
    

    Its very similar to the PHP mail() function so you would send an email as stevejobs to bill gates as follows, using the msmtp account “apple”:

    msmtp(“billgates@microsoft.com“, “Hey, please read this”, “You are too rich, give me all your money“, “From: stevejobs@apple.com“, “apple“)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is actually 2 questions... Background: After using the command line in MySQL for
Use Eclipse Classic with ADT plugin. Tried to make project from existing example of
Use Memcache php class to interact with the memcached. At the beginning all works
Use default: <input type=radio name=restype value=resdef onfocus=document.getElementById('resupload').disabled = true; document.getElementById('resadres').disabled = true; checked=checked /><br
use qcvalues_test go select [finalConc] ,[rowid] from qvalues where rowid in (select rowid from
Use AES/Rijndael or any symmetric encryption. Encrypt the hidden value using itself as the
use grep command to find txt files containing telephone number. telephone number format could
Use http://jobs.sitesixteen.com/ for reference. I'm using YQL for the city, state auto-complete. IF you
USE AdventureWorks; GO BEGIN TRANSACTION; GO DELETE FROM HumanResources.JobCandidate WHERE JobCandidateID = 10; DELETE
USE AdventureWorks2008R2; GO INSERT INTO myTestSkipField SELECT * FROM OPENROWSET(BULK 'C:\myTestSkipField-c.dat', FORMATFILE='C:\myTestSkipField.fmt' ) AS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.