Visualizzazione dei risultati da 1 a 3 su 3

Discussione: PHP mandare mail

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2010
    Messaggi
    42

    PHP mandare mail

    Dovrei mandare delle mail con php nel modo più semplice (cioè con sendmail ma se necessario posso anche usare postfix).
    Questo codice restiruisce la pagina naturalmente ma non arriva la mail.
    codice:
    $mail = mia@mail.it
    $message = "Per continuare la procedura di iscrizione clicca sul link sottostante:
    link
    Se hai ricevuto questa mail per sbaglio non fare niente, il tuo indirizzo mail verrà cancellato automaticamente.
    ";
    mail($mail, 'My Subject', $message);
    Ho già visto che bisogna impostare il php.ini, ma quale? Io ne ho diversi. Inoltre non ho ancora capito se è necessario un
    servizio SMTP.

    codice:
    m@marco ~ $ php -v
    PHP 5.3.5-pl0-gentoo (cli) (built: Feb  7 2011 18:42:10) 
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    m@marco ~ $ ls -la /etc/apache2
    total 44
    drwxr-xr-x  5 root root  4096 Aug 31  2010 .
    drwxr-xr-x 90 root root  4096 Mar 22 12:03 ..
    -rw-r--r--  1 root root  6519 Nov 19 20:35 httpd.conf
    -rw-r--r--  1 root root 12958 Aug 31  2010 magic
    drwxr-xr-x  2 root root  4096 Feb  7 19:11 modules.d
    drwxr-xr-x  2 root root  4096 Sep 20  2009 ssl
    drwxr-xr-x  2 root root  4096 Feb 15 17:18 vhosts.d
    m@marco ~ $ ls -la /etc/php
    total 32
    drwxr-xr-x  8 root root 4096 Feb  3 23:17 .
    drwxr-xr-x 90 root root 4096 Mar 22 12:03 ..
    drwxr-xr-x  4 root root 4096 Nov 18 13:02 apache2-php5
    drwxr-xr-x  4 root root 4096 Feb  7 19:11 apache2-php5.3
    drwxr-xr-x  4 root root 4096 Feb  3 23:17 cgi-php5
    drwxr-xr-x  4 root root 4096 Feb  7 19:11 cgi-php5.3
    drwxr-xr-x  4 root root 4096 Feb  3 23:17 cli-php5
    drwxr-xr-x  4 root root 4096 Feb  7 19:11 cli-php5.3
    m@marco ~ $ php -i | grep mail
    mail.add_x_header => On => On
    mail.force_extra_parameters => no value => no value
    mail.log => no value => no value
    sendmail_from => no value => no value
    sendmail_path => /usr/sbin/sendmail -t -i  => /usr/sbin/sendmail -t -i 
    PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in Unknown on line 0
    Path to sendmail => /usr/sbin/sendmail -t -i 
    MAIL => /var/mail/m
    _SERVER["MAIL"] => /var/mail/m

  2. #2
    Utente di HTML.it
    Registrato dal
    Jan 2010
    Messaggi
    42
    Un pò di aiuto? Dai, non è difficile...

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2010
    Messaggi
    42
    Help ho già impostato nello script i seguenti valori:
    codice:
    ini_set("SMTP", "127.0.0.1"); 
    ini_set("smtp_port", "25");
    ini_set("sendmail_from", "ciao@ciao.it");
    e il file sendmail punta a postifx:
    codice:
    marco sfAg # ls -la /usr/sbin/sendmail
    lrwxrwxrwx 1 root root 17 Mar 29 11:46 /usr/sbin/sendmail -> /usr/sbin/postfix
    Non sò se ho impostato correttamente il main.cf:
    codice:
    m@marco /var/www/localhost/htdocs/sfAg $ cat /etc/postfix/main.cf  | grep -v -E '(^#|^$)'
    queue_directory = /var/spool/postfix
    command_directory = /usr/sbin
    daemon_directory = /usr/lib64/postfix
    data_directory = /var/lib/postfix
    mail_owner = postfix
    myhostname = marco.mshome.net
    mydomain = mshome.net
    mydestination = $myhostname, localhost.$mydomain
    unknown_local_recipient_reject_code = 550
    mynetworks = 10.0.0.1
    alias_maps = hash:/etc/postfix/aliases
    alias_database = hash:/etc/postfix/aliases
     
      
    debug_peer_level = 2
    debugger_command =
    	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
    	 ddd $daemon_directory/$process_name $process_id & sleep 5
    sendmail_path = /usr/sbin/sendmail
    newaliases_path = /usr/bin/newaliases
    mailq_path = /usr/bin/mailq
    setgid_group = postdrop
    html_directory = no
    manpage_directory = /usr/share/man
    sample_directory = /etc/postfix
    readme_directory = no
    home_mailbox = .maildir/

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.