In order to send email from the new project web, you need to do the following configuration steps:
Configure your project web scripts to access our email server via either TLS or SSL SMTP using the following settings:
host: prwebmail (or ssl://prwebmail)
port: 25 (or 465 for ssl)
Be sure to set the permissions on file that contains your password to not be world readable:
chmod o-r whatever.php
If you see an error about the smtp server not supporting authorization, you are accessing port 25 without TLS. Unencrypted connections are not supported.
If you see an error about email relay not being supported, you didn't specify the right user (project) & password credentials.
Here are a couple examples of how to configure email for project web. These examples use TLS via the normal port 25, but various software might be more easily configured to use ssl access via port 465.
<?php include('Mail.php'); $recipients = array( 'email@example.com' ); # Can be one or more emails $headers = array ( 'From' => 'firstname.lastname@example.org', 'To' => join(', ', $recipients), 'Subject' => 'Testing email from project web', ); $body = "This was sent via php from project web!\n"; $mail_object =& Mail::factory('smtp', array( 'host' => 'prwebmail', 'auth' => true, 'username' => 'YOUR_PROJECT_NAME', 'password' => 'PASSWORD', # As set on your project's config page #'debug' => true, # uncomment to enable debugging )); $mail_object->send($recipients, $headers, $body);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/perl use strict; use warnings; use Net::SMTP::TLS; my $mailer = new Net::SMTP::TLS( 'prwebmail', Hello => 'localhost', Port => 25, User => 'YOUR_PROJECT_NAME', Password => 'PASSWORD', # As set on your project's config page ); my $subject = 'Testing email from project web'; my $body = "This was sent via perl from project web!\n"; $mailer->mail('email@example.com'); # From $mailer->to('Somebody <firstname.lastname@example.org'); $mailer->data; $mailer->datasend("Subject: $subject\n\n$body"); $mailer->dataend; $mailer->quit;