ISPConfig need help with php mail()

Discussion in 'General' started by VIRTUAL, Jul 20, 2011.


    VIRTUAL New Member

    Hello, everyone,

    I'll try to tell what i want :)

    When you create website (domain will be:, you login to ftp and create file e.g. mail.php
    in this file write:

    mail('[email protected]', 'Subject', 'Body');

    and then it runs you getting email, everything ok, but is problem you getting mail from [email protected], but i need that default mail will be like domain e.g. [email protected] or [email protected]

    And the same goes with another domains?

    if i use header doesn't helping that, because gmail will write: you go mail from Noreplay via, i need that it whos real domain where it was send.

    Thank you for your help.

    p.s. sorry for my english gramma
  2. erosbk

    erosbk New Member

    If you use mod_php that is what happens, user of apache send the mail (www-data).

    If you use fcgi, [email protected] is the sender... I am trying to manipulate this... but I don't know where to begin :p
  3. Toucan

    Toucan Member

    I think this is probably now in the wrong forum, but....

    $to = "[email protected]";
    $subject = "Backup Complete";
    $stampit = date("h:m d/m/y");
    $message = "database and spreadsheets were backed up today $stampit .";
    $from = "[email protected]";
    $headers = "From: $from";

    Add the head into your script as above.

    VIRTUAL New Member

    So I made same research for this:
    In file I write this code:
    $mail_from '[email protected]';
    $date date("Y-m-d H:i:s");
    $version '[SuPHP]';
    $to      '[email protected]';
    $subject $version.' The Subject 1 + ' $date;
    $message 'hello 2011';
    $headers 'From: '.$mail_from "\r\n" .
    'Reply-To: '.$mail_from "\r\n" .
    'X-Mailer: PHP/' phpversion(); 
    <?php mail
    ($to$version.'The Subject 2 + '.$date'the message'null'-f'.$mail_from); ?>
    <? mail
    ($to$version.'The Subject 3 + '.$date'the message'); ?>
    And result for receive mail:

    1. [email protected] via for me
    2. [email protected] for me
    3. [email protected] for me

    1. [email protected] via for me
    2. [email protected] for me
    3. [email protected] for me

    1. [email protected] for me
    2. www-data [email protected] for me
    3. www-data [email protected] for me

    1. [email protected] via for me
    2. [email protected] for me
    3. [email protected] for me

    So in conclusion the best way to use is mod-PHP, but

    How to change for default the name webmaster for me
    and change www-data name?
    Last edited: Jul 21, 2011
  5. falko

    falko Super Moderator ISPConfig Developer


    VIRTUAL New Member

    I know that, but user wants to have default names. like i said that they want to see using mail('to', 'subject', 'body'); not the www-data, but Like NotReplay and using without headers.
  7. falko

    falko Super Moderator ISPConfig Developer

    If you don't want to use additional headers, mails are sent as the user that runs the Apache vhost. So you have to make the desired sender the owner of the vhost.

Share This Page