It is currently Thu Nov 26, 2020 9:57 am
All times are UTC + 8 hours

PHP Mail

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

Re: PHP Mail

Postby Mechano » Fri Mar 14, 2014 11:05 pm

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.
Mechano
 
Posts: 25
Joined: Wed Mar 12, 2014 7:34 am

Re: PHP Mail

Postby Kapitein Haak » Sat Mar 15, 2014 12:00 am

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
User avatar
Kapitein Haak
 
Posts: 333
Joined: Tue Oct 15, 2013 2:40 pm
Location: Stranded on the Dutch coast.

Re: PHP Mail

Postby murray » Wed Apr 02, 2014 10:36 am

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
murray
 
Posts: 1
Joined: Wed Apr 02, 2014 10:00 am

Re: PHP Mail

Postby Mechano » Wed Apr 02, 2014 5:36 pm

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
Mechano
 
Posts: 25
Joined: Wed Mar 12, 2014 7:34 am

Re: PHP Mail

Postby freecom » Mon Apr 21, 2014 2:29 pm

Hello, did you find a solution to use sendmail ?
freecom
 
Posts: 1
Joined: Mon Apr 21, 2014 2:27 pm

Re: PHP Mail

Postby Mechano » Thu May 08, 2014 11:13 pm

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...
Mechano
 
Posts: 25
Joined: Wed Mar 12, 2014 7:34 am

Re: PHP Mail

Postby gianluigi1982 » Fri Sep 05, 2014 10:34 pm

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: 24
Joined: Mon Jan 20, 2014 5:10 pm

Re: PHP Mail

Postby gianluigi1982 » Thu Mar 05, 2015 7:31 pm

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
gianluigi1982
 
Posts: 24
Joined: Mon Jan 20, 2014 5:10 pm

Previous

Return to Web Hosting

  • You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum
  • Who is online

    Users browsing this forum: No registered users and 1 guest