Kiwihosting Support Forum: Script based emails (Shared Hosting) - Kiwihosting Support Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Script based emails (Shared Hosting)

#1 User is offline   Kiwihost 

  • Group: Admin
  • Posts: 2361
  • Joined: 27-October 02

Posted 28 May 2007 - 06:38 PM

We've had a few queries recently around issues with script based emails, so here's some information to bear in mind that may help some of you out

If you do not have a script properly configured to send mail, it may send emails out in the form of ftpuser@(unix|nt)XX.hsphere.cc. For example, davejoe2@unix18.hsphere.cc. This is bad because it's not a proper email address, but more importantly look at this: if you have a lot of domains under that account (for example, 30) and each domain sends 100 emails out, you've exceeded the 2,000 emails per day limit and will get blacklisted.

How do I fix it?
For PHP you will need to change your script from this:
mail($to,$subject,$body);
to this:
mail($to,$subject,$body,'From: user@domain.com','-fuser@domain.com');
Replace user@domain.com with your from email address, and make sure to include the dash before the email address in the last parameter!
If you are on Windows, you will also need to do the following:
  • download the attached php.ini
  • Open up the php.ini file in a text editor like Notepad.
  • Search for sendmail_from and replace the email address that is there with your from email address.
  • Save the file and put it in the root directory of your site.
If you are on Unix, you may want to consider adding this to the .htaccess file in the root directory of your site:
php_value sendmail_from user@domain.com
If such a file does not exist, you will need to create it.

For formmail.cgi, you will need to properly configure your formmail.cgi file so that it sends out from a proper from address.
  • Open the your formmail.cgi file with a text editor.
  • Change the following line:
    $mailprog = '/usr/sbin/sendmail -i -t';
    to
    $mailprog = '/usr/sbin/sendmail -i -t -fYour From Email Address';
    Note that there is a -f followed by the email address without spaces.
  • Save the file and upload it to the server.

Attached File(s)

  • Attached File  php.ini (38.29K)
    Number of downloads: 36

Kiwihosting.net Ltd
NZ Web Hosting Specialists
http://www.kiwihosting.net.nz

#2 User is offline   Kiwihost 

  • Group: Admin
  • Posts: 2361
  • Joined: 27-October 02

Posted 27 April 2008 - 06:35 PM

An alternative method for setting the sendmail_from instead of using the full php.ini

ini_set ("sendmail_from","webmaster@MyWebSite.com");

Place it at the top of your page within the php tags.
Kiwihosting.net Ltd
NZ Web Hosting Specialists
http://www.kiwihosting.net.nz

#3 User is offline   oztrades 

  • Group: Customers
  • Posts: 69
  • Joined: 16-March 03

Posted 31 December 2008 - 03:56 AM

Now that we are shifting to HELM (shared hosting) is the above php.ini file still relevant?

Cheers
Oztrades
oztrades - my place

#4 User is offline   Kiwihost 

  • Group: Admin
  • Posts: 2361
  • Joined: 27-October 02

Posted 31 December 2008 - 06:32 AM

We run PHP under fastcgi on the HELM servers so the php.ini will not have any effect, If you need something specific set you'll need to do it via ini_set in your code, or request us to consider changing the default configuration.
Kiwihosting.net Ltd
NZ Web Hosting Specialists
http://www.kiwihosting.net.nz

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users