PHP Mail

Web hosting, MySQL, PHP and all that good stuff.

Moderator: Lillian.W@AST

Mechano
Posts: 25
youtube meble na wymiar Warszawa
Joined: Wed Mar 12, 2014 7:34 am

Re: PHP Mail

Post by Mechano »

There isn't any mailer-daemon listening on localhost also modifying the php.ini the mail will not go...

You need to use PEAR library and the PHPMailer class to send thru an external SMTP server with authentication.

Code: Select all

require_once('/library/PHPMailer/class.phpmailer.php');
$mail = new \PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = 'login';
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = 'example@gmail.com';
$mail->Password = 'somepassword';
$mail->SetFrom('example@gmail.com', 'Example');
$mail->Subject = 'The subject';
$mail->Body = 'The content';
$mail->AddAddress('receiver@gmail.com');
$mail->Send();
There's also another way, using plain PHP, if your cable/ADSL provider gives you SMTP server without authentication change localhost with it's smtp server.
User avatar
Kapitein Haak
Posts: 333
Joined: Tue Oct 15, 2013 2:40 pm
Location: Stranded on the Dutch coast.

Re: PHP Mail

Post by Kapitein Haak »

ADM 2.2 will support a mailserver on the NAS. This might take a few weeks however.

BR, Kapitein Haak.
"What would the world be like without Captain Hook?"
---
"Homo sapiens non urinat in ventum" (A wise man doesn't piss into the wind), only in Amsterdam:
https://www.google.nl/maps/@52.36289,4. ... 312!8i6656
murray
Posts: 1
Joined: Wed Apr 02, 2014 10:00 am

Re: PHP Mail

Post by murray »

Kapitein Haak wrote:ADM 2.2 will support a mailserver on the NAS. This might take a few weeks however.

BR, Kapitein Haak.
Hi Kaipitein Haak
I have a Asustor AS-304T and I have setup a local website which works well. This Wordpress site has a "Contact Us" page which needs to send an email. Please confirm the discussion here is addressing this issue and I am on the right track to solving the problem. If yes then are you saying if I wait a few weeks then you will have a solution using a mailserver for the AS-304T?
Thanks.............Murray
Mechano
Posts: 25
Joined: Wed Mar 12, 2014 7:34 am

Re: PHP Mail

Post by Mechano »

murray wrote:
Kapitein Haak wrote:ADM 2.2 will support a mailserver on the NAS. This might take a few weeks however.

BR, Kapitein Haak.
Hi Kaipitein Haak
I have a Asustor AS-304T and I have setup a local website which works well. This Wordpress site has a "Contact Us" page which needs to send an email. Please confirm the discussion here is addressing this issue and I am on the right track to solving the problem. If yes then are you saying if I wait a few weeks then you will have a solution using a mailserver for the AS-304T?
Thanks.............Murray
You have to use a plugin that uses external SMTP servers.
Like this:
http://wp-ecommerce.net/easy-wordpress- ... erver-2197
freecom
Posts: 1
Joined: Mon Apr 21, 2014 2:27 pm

Re: PHP Mail

Post by freecom »

Hello, did you find a solution to use sendmail ?
Mechano
Posts: 25
Joined: Wed Mar 12, 2014 7:34 am

Re: PHP Mail

Post by Mechano »

freecom wrote:Hello, did you find a solution to use sendmail ?
Nope, cant' wait for the new ADM 2.2 that promises to fill di lack...
gianluigi1982
Posts: 25
Joined: Mon Jan 20, 2014 5:10 pm

Re: PHP Mail

Post by gianluigi1982 »

1. I installed the Mail server App
2. It works as mail server
3. I installed a template with a Contact page that ask for the mail() function.
4. It doesn't work.
5. I installed a plugin in Wordpress called WP SMTP
6. Then I changed the function in the template from mail (..........) to wp_mail(..........)
7. In this way it works

The only remaining issue is that many functions from the template contact page don't work:
- mail from : mail will arrive from the sender you specified in the WP SMTP settings page
- Subject: subject will be what you specified in the WP SMTP settings page

Hope it will be useful to someone.
gianluigi1982
Posts: 25
Joined: Mon Jan 20, 2014 5:10 pm

Re: PHP Mail

Post by gianluigi1982 »

I already configured the Mail Server App on my NAS.
I configured the SMTP server and it works only with Wordpress by configuring the wp_mail() function.

I tried to edit the php.ini by inserting the smtp server installed but the "standard" mail() function doens't work.

I am trying to set a second webpage (in Wordpress too) andI need the mail() function to make the OpenConf platform to correctly works.
I also tried to edit the OpenConf files to use wp_mail() without success.

Is there anyone who solved this issue?

Many thanks.

Gianluigi
Post Reply

Return to “Web Hosting”