Jump to content


New Members
  • Posts

  • Joined

  • Last visited

Everything posted by pieterjandc

  1. Haha nice. It works perfectly now. You are a genius. Final configuration sudo nano /etc/ssmtp/revaliases Now contains: root:my_account@telenet.be:smtp.telenet.be:587 pi:my_account@telenet.be:smtp.telenet.be:587 www-data:my_account@telenet.be:smtp.telenet.be:587 Result of mail() is actually '1' now as well. Thanks for the help. I really appreciate. Only 1 question left: Would it be possible to change the configuration so that the mail doesn't appear to be coming from www-data@pieterjan.pro ?
  2. I hope the user will be smart enough to use mysqli_real_escape_string, so obvious cause everybody already uses it. He's just asking a way to itterate the post-data in an easy way
  3. Hi, I'm trying to send a mail from a Webpage (PHP), running on a Raspberry Pi (Apache2, PHP5). The Raspberry Pi is behind a Router from my ISP (Telenet) and they block the SMTP-port(25). But I successfully installed sSMTP with all needed configuration, and I'm able to send emails through the mailhub of my ISP (what off course is what they rather like). sudo nano /etc/ssmtp/ssmtp.conf Contains: root=pieterjan@pieterjan.pro mailhub=smtp.telenet.be:587 rewriteDomain=pieterjan.pro hostname=pieterjan.pro UseTLS=YES UseSTARTTLS=Yes AuthUser=my_account@telenet.be AuthPass=my_password AuthMethod=LOGIN FromLineOverride=YES And my Reverse-aliases-file: sudo nano /etc/ssmtp/revaliases Contains: root:my_account@telenet.be:smtp.telenet.be:587 pi:my_account@telenet.be:smtp.telenet.be:587 With this configuration I'm able to send an e-mail using this bash-command: echo "Email body" | mail -s "Test Subject" some-email@address.com Next step: I've tried to change the configuration of PHP5 to use the PHP mail() command: sudo nano /etc/php5/apache2/php.ini Contains: [mail function] ; For Win32 only. ; http://php.net/smtp ;SMTP = localhost ; http://php.net/smtp-port ;smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = pi@pieterjan.pro ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = /usr/sbin/sendmail -t -i -f pi@pieterjan.pro ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(). ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by t$ mail.add_x_header = On ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ;mail.log = ; Log mail to syslog (Event Log on Windows). ;mail.log = syslog I've already tried about everything. I think sendmail should only be used in WAMP and therefore is not applicable. Some say sendmail is automatically linked to ssmtp. But I actually already tried loads of configurations: sendmail_path = /usr/sbin/sendmail -t sendmail_path = /usr/sbin/sendmail -t -i sendmail_path = /usr/sbin/sendmail -t -i -f pi@pieterjan.pro sendmail_path = /usr/sbin/ssmtp -t sendmail_path = /usr/sbin/ssmtp -t -i PHP-code: <?php error_reporting(E_ALL|E_STRICT); ini_set('display_errors',1); $res = mail("pieterjandeclippel@msn.com", "Subject", "Hello!"); echo '<hr>Result was: ' . ( $res === FALSE ? 'FALSE' : 'TRUE') . $res; echo '<hr>'; phpinfo(); ?> This script is hosted here. But nothing actually seems to work, and I'm getting this error: cat /var/log/mail.log Last error from the log-file: Jan 8 20:53:38 pieterjan sSMTP[9209]: Creating SSL connection to host Jan 8 20:53:38 pieterjan sSMTP[9209]: SSL connection using DHE_RSA_AES_128_CBC_SHA1 Jan 8 20:53:38 pieterjan sSMTP[9209]: 550 5.1.0 <www-data@pieterjan.pro> is not an alias of my_account@telenet.be Extra information (entire procedure) : Website What is the problem and how can I fix this?
  4. Best answer ever ? Here you go: <?php // table with following columns: // id(Auto-Increment), naam, straatnummer, postcodestad if(!empty($_POST)) { $db=mysqli_connect("localhost","root","sql_password","db_name"); $keys = implode(',',array_keys($_POST)); $values = implode(', ', array_map( function ($v) { return sprintf("'%s'", $v); }, $_POST )); $query = "INSERT INTO personen(" . $keys . ") VALUES(" . $values . ")"; mysqli_query($db,$query); mysqli_close($db); echo($query); } else { ?> <!DOCTYPE html> <html> <head> </head> <body> <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="POST"> <table> <tr> <td>Naam</td> <td><input type="text" name="naam"></td> </tr> <tr> <td>Straat & nummer</td> <td><input type="text" name="straatnummer"></td> </tr> <tr> <td>Postcode & stad</td> <td><input type="text" name="postcodestad"></td> </tr> <tr> <td colspan="2"><input type="submit" value="Opslaan"></td> </tr> </table> </form> </body> </html> <?php } ?>
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.