News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Activation Mail Not Being Sent

Started by Rudy23, October 13, 2015, 03:24:24 AM

Previous topic - Next topic

Rudy23

I'm running SMF 2.0.11 on a CentOs 7 64-bit version VPS. Mail type is set to PHP as I don't have a SSL license on the server and can't use gmail. That's the reason I want the PHP mail type get to working.

The following script gives me a success:
<?php
// Add your name between quotes
$from_name "YourName";
// Add the origin email address between quotes (the same email you set in SMF's Webmaster email address)
$from_email "[email protected]";
$headers "From: $from_name <$from_email>";
// You are free to change the body and subject of the test email in the next lines, but the default should work fine
$body "Hi, \nThis is a test mail from $from_name <$from_email>.";
$subject "Test mail from localhost";
// Add the destination email address between quotes (the recipient of the test email)
$to "[email protected]";
// When running the script, you will see in your browser "Success!" or "Fail...", depending on whether the test was successful or not. DON'T CHANGE THIS
if (mail($to$subject$body$headers)) {
   echo 
"Success!";
} else {
   echo 
"Fail...";
}
?>


Any help is appreciated.

margarett

And do you get the test email?
(do note, you need to replace "[email protected]" and "[email protected]" with valid addresses)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Rudy23

Yes I did replace those parts but I didn't get the test mail.

margarett

Yeah, then it's a server configuration issue. SMF will also not be able to send emails.

You need to check the server logs, maybe something will pop up. Did you setup the VPS yourself? Do you have any SMTP service installed? Does the "from_email" account actually exists on the server?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Rudy23

I installed the VPS myself yes. Well I'm new to this and I'm not sure how to make a mail address. :-\

I am using sendmail SMTP service.

margarett

I can't help you because I never dealt with that.

But you need to be careful. It's dangerous to run your own server when you don't have knowledge to do so... Not saying that you shouldn't do it, but you should get more know-how before you open a server to the Internet.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

青山 素子

Quote from: Rudy23 on October 13, 2015, 03:24:24 AM
I don't have a SSL license on the server and can't use gmail.

You don't need a certificate to use Google's SMTP servers.

Quote from: Rudy23 on October 13, 2015, 03:24:24 AM
The following script gives me a success:

That means PHP can submit on the server directly, which is good. You'll want to check your system mail log (usually /var/log/maillog, or use "journalctl -u postfix") to see what's happening on trying to send the mail.


Quote from: margarett on October 13, 2015, 02:19:39 PM
But you need to be careful. It's dangerous to run your own server when you don't have knowledge to do so... Not saying that you shouldn't do it, but you should get more know-how before you open a server to the Internet.

Exactly this. Running a server is not a skill for someone completely new to things. It's way too easy to mess up and create a security issue.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Rudy23

It used to work two months ago but now it doesn't seem to work at all.

青山 素子

Quote from: Rudy23 on October 14, 2015, 09:29:55 AM
It used to work two months ago but now it doesn't seem to work at all.

There can be a lot of reasons for that, but without you looking where it's been suggested you look, we can't really do anything else to help you out. Please look at the mail logs and see what they say.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Rudy23

Ok I got the sendmail service to work with the testmail.php script I posted above. It works, I get the mail and here is the output:
QuoteJan  3 17:43:41 ramnode sendmail[12270]: u03GhfIX012270: from=apache, size=223, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost
Jan  3 17:43:41 ramnode sendmail[12271]: u03GhfeH012271: from=<[email protected]>, size=440, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=vwh-rp.com [127.0.0.1]
Jan  3 17:43:41 ramnode sendmail[12270]: u03GhfIX012270: [email protected], ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30223, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u03GhfeH012271 Message accepted for delivery)
Jan  3 17:43:41 ramnode sendmail[12273]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Jan  3 17:43:41 ramnode sendmail[12273]: u03GhfeH012271: to=<[email protected]>, ctladdr=<[email protected]> (48/48), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120440, relay=gmail-smtp-in.l.google.com. [IPv6:2a00:1450:4013:c01::1b], dsn=2.0.0, stat=Sent (OK 1451839421 cv6si50473770wjb.68 - gsmtp)

And this is when SMF tries to send the mail (Mail is not received at all):
QuoteJan  3 17:43:27 ramnode sendmail[12262]: u03GhRls012262: from=apache, size=1727, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost
Jan  3 17:43:27 ramnode sendmail[12263]: u03GhRf2012263: from=<[email protected]>, size=1870, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=vwh-rp.com [127.0.0.1]
Jan  3 17:43:27 ramnode sendmail[12262]: u03GhRls012262: [email protected], ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31727, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u03GhRf2012263 Message accepted for delivery)
Jan  3 17:43:27 ramnode sendmail[12265]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Jan  3 17:43:27 ramnode sendmail[12265]: u03GhRf2012263: to=<[email protected]>, ctladdr=<[email protected]> (48/48), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=121870, relay=gmail-smtp-in.l.google.com. [IPv6:2a00:1450:4013:c01::1b], dsn=5.0.0, stat=Service unavailable
Jan  3 17:43:27 ramnode sendmail[12265]: u03GhRf2012263: u03GhRf2012265: DSN: Service unavailable
Jan  3 17:43:27 ramnode sendmail[12265]: u03GhRf2012265: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=33093, dsn=2.0.0, stat=Sent

Advertisement: