Configuring EMail php to work

Hello. I have some php script that confirmed to work but it does not work on profreehosting. Could anyone of you help me make the script work with profreehosting please?
Here is the code:

<?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Subject'; // Your email address. This is where the form information will be sent. $emailadd = '[email protected]'; // Where to redirect after form is processed. $url = 'redirect.com'; // Makes all fields required. If set to '1' no field can be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Submission Information:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 40) {echo "Name of form element $key cannot be longer than 40 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } //'From: '.$emailadd.'' mail($emailadd, $subject, $text, "From: \""."WEB_CONTACT_SUBMISSION"."\"\n"); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?>
«1

Comments

  • <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Subject'; // Your email address. This is where the form information will be sent. $emailadd = '[email protected]'; // Where to redirect after form is processed. $url = 'redirect.com'; // Makes all fields required. If set to '1' no field can be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Submission Information:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 40) {echo "Name of form element $key cannot be longer than 40 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } //'From: '.$emailadd.'' mail($emailadd, $subject, $text, "From: \""."WEB_CONTACT_SUBMISSION"."\"\n"); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?>
    Update: This is the proper formatted code

  • I don't think it is your script as much as the "[email protected]" I would say this is what your looking for: freemail.byetcluster.com [185.27.132.238]) How to implement into code is another deal.

    You must have an email account created in the control panel in order for php mailer (script) to work. Plus the MX entries are a bitch.

    My mx entries are:

    badtech.ezyro.com  mx.byetcluster.com. 0   
    badtech.ezyro.com   mx.ezyro.com.   0   
    cedartree.gq    mx.cedartree.gq.    0   
    eeag.ezyro.com  mx.byetcluster.com. 0

    The forum ( https://cedartree.gq/ezy/ ) registration email script did send an email. I had to change to utf8 for the email verification link to work correctly. But it has been so long ago I don't know if it still works. And no one uses the forum.

    The script would not send() until email account created, mx records added, and user (PFH email address) into the forum mail script. Third party domain email will not work. Must be a profreehost email account.

  • @badbot said:
    I don't think it is your script as much as the "[email protected]" I would say this is what your looking for: freemail.byetcluster.com [185.27.132.238]) How to implement into code is another deal.

    You must have an email account created in the control panel in order for php mailer (script) to work. Plus the MX entries are a bitch.

    My mx entries are:

    badtech.ezyro.com    mx.byetcluster.com. 0   
    badtech.ezyro.com mx.ezyro.com.   0   
    cedartree.gq  mx.cedartree.gq.    0   
    eeag.ezyro.com    mx.byetcluster.com. 0

    The forum ( https://cedartree.gq/ezy/ ) registration email script did send an email. I had to change to utf8 for the email verification link to work correctly. But it has been so long ago I don't know if it still works. And no one uses the forum.

    The script would not send() until email account created, mx records added, and user (PFH email address) into the forum mail script. Third party domain email will not work. Must be a profreehost email account.

    My question is how to change it to UTF-8?

  • @badbot said:
    I don't think it is your script as much as the "[email protected]" I would say this is what your looking for: freemail.byetcluster.com [185.27.132.238]) How to implement into code is another deal.

    You must have an email account created in the control panel in order for php mailer (script) to work. Plus the MX entries are a bitch.

    My mx entries are:

    badtech.ezyro.com    mx.byetcluster.com. 0   
    badtech.ezyro.com mx.ezyro.com.   0   
    cedartree.gq  mx.cedartree.gq.    0   
    eeag.ezyro.com    mx.byetcluster.com. 0

    The forum ( https://cedartree.gq/ezy/ ) registration email script did send an email. I had to change to utf8 for the email verification link to work correctly. But it has been so long ago I don't know if it still works. And no one uses the forum.

    The script would not send() until email account created, mx records added, and user (PFH email address) into the forum mail script. Third party domain email will not work. Must be a profreehost email account.

    So how would I add my email to the mx entries? I want to use my gmail account for it all

  • @Dragnorian said:

    @badbot said:
    I don't think it is your script as much as the "[email protected]" I would say this is what your looking for: freemail.byetcluster.com [185.27.132.238]) How to implement into code is another deal.

    You must have an email account created in the control panel in order for php mailer (script) to work. Plus the MX entries are a bitch.

    My mx entries are:

    badtech.ezyro.com  mx.byetcluster.com. 0   
    badtech.ezyro.com   mx.ezyro.com.   0   
    cedartree.gq    mx.cedartree.gq.    0   
    eeag.ezyro.com  mx.byetcluster.com. 0

    The forum ( https://cedartree.gq/ezy/ ) registration email script did send an email. I had to change to utf8 for the email verification link to work correctly. But it has been so long ago I don't know if it still works. And no one uses the forum.

    The script would not send() until email account created, mx records added, and user (PFH email address) into the forum mail script. Third party domain email will not work. Must be a profreehost email account.

    So how would I add my email to the mx entries? I want to use my gmail account for it all

    @Dragnorian said:

    @badbot said:
    I don't think it is your script as much as the "[email protected]" I would say this is what your looking for: freemail.byetcluster.com [185.27.132.238]) How to implement into code is another deal.

    You must have an email account created in the control panel in order for php mailer (script) to work. Plus the MX entries are a bitch.

    My mx entries are:

    badtech.ezyro.com  mx.byetcluster.com. 0   
    badtech.ezyro.com   mx.ezyro.com.   0   
    cedartree.gq    mx.cedartree.gq.    0   
    eeag.ezyro.com  mx.byetcluster.com. 0

    The forum ( https://cedartree.gq/ezy/ ) registration email script did send an email. I had to change to utf8 for the email verification link to work correctly. But it has been so long ago I don't know if it still works. And no one uses the forum.

    The script would not send() until email account created, mx records added, and user (PFH email address) into the forum mail script. Third party domain email will not work. Must be a profreehost email account.

    So how would I add my email to the mx entries? I want to use my gmail account for it all

    MX Entries are custom for your domain.
    Like mine. [email protected]
    That is how I use my email, you can try sending a email to it and I will try to send it back so you can see that it works.
    Do not worry, I do not spam emails.
    But if it does not appear in your inbox check your spam folder.
    Sometimes it ends up in the updates folder for no reason :/

  • edited June 26

    @Dragnorian said:
    So how would I add my email to the mx entries? I want to use my gmail account for it all

    Third party domain email WILL NOT work. I tried but I could not figure it out. To use gmail you would have to add "SPF Record". The php mailer localhost uses freemail.byetcluster.com. Adding the SPF Record and google mx record should work. Admin uses zoho mail. I have not been able to get it working.

    free services do not seem to support it any more. Only a PFH email account can pass threw freemail.byetcluster.com.

  • @TheCrafters said:
    My question is how to change it to UTF-8?

    In vanilla forum had to change a line in "class.email.php". The file name would be most likely the same in any opensource script. Location of file may be different.

    Newer version updates may cause it to brake. May not.

  • @TheCrafters said:

    @Dragnorian said:

    @badbot said:
    I don't think it is your script as much as the "[email protected]" I would say this is what your looking for: freemail.byetcluster.com [185.27.132.238]) How to implement into code is another deal.

    You must have an email account created in the control panel in order for php mailer (script) to work. Plus the MX entries are a bitch.

    My mx entries are:

    badtech.ezyro.com    mx.byetcluster.com. 0   
    badtech.ezyro.com mx.ezyro.com.   0   
    cedartree.gq  mx.cedartree.gq.    0   
    eeag.ezyro.com    mx.byetcluster.com. 0

    The forum ( https://cedartree.gq/ezy/ ) registration email script did send an email. I had to change to utf8 for the email verification link to work correctly. But it has been so long ago I don't know if it still works. And no one uses the forum.

    The script would not send() until email account created, mx records added, and user (PFH email address) into the forum mail script. Third party domain email will not work. Must be a profreehost email account.

    So how would I add my email to the mx entries? I want to use my gmail account for it all

    @Dragnorian said:

    @badbot said:
    I don't think it is your script as much as the "[email protected]" I would say this is what your looking for: freemail.byetcluster.com [185.27.132.238]) How to implement into code is another deal.

    You must have an email account created in the control panel in order for php mailer (script) to work. Plus the MX entries are a bitch.

    My mx entries are:

    badtech.ezyro.com    mx.byetcluster.com. 0   
    badtech.ezyro.com mx.ezyro.com.   0   
    cedartree.gq  mx.cedartree.gq.    0   
    eeag.ezyro.com    mx.byetcluster.com. 0

    The forum ( https://cedartree.gq/ezy/ ) registration email script did send an email. I had to change to utf8 for the email verification link to work correctly. But it has been so long ago I don't know if it still works. And no one uses the forum.

    The script would not send() until email account created, mx records added, and user (PFH email address) into the forum mail script. Third party domain email will not work. Must be a profreehost email account.

    So how would I add my email to the mx entries? I want to use my gmail account for it all

    MX Entries are custom for your domain.
    Like mine. [email protected]
    That is how I use my email, you can try sending a email to it and I will try to send it back so you can see that it works.
    Do not worry, I do not spam emails.
    But if it does not appear in your inbox check your spam folder.
    Sometimes it ends up in the updates folder for no reason :/

    So how would I then set up my MX Record?

  • @badbot said:

    @TheCrafters said:
    My question is how to change it to UTF-8?

    In vanilla forum had to change a line in "class.email.php". The file name would be most likely the same in any opensource script. Location of file may be different.

    Newer version updates may cause it to brake. May not.

    what line do I change on "class.email.php" is it 43 to 56?

    function __construct() {
            $this->PhpMailer = new \Vanilla\VanillaMailer();
            $this->PhpMailer->CharSet = 'utf-8';
            $this->PhpMailer->SingleTo = c('Garden.Email.SingleTo', false);
            $this->PhpMailer->Hostname = c('Garden.Email.Hostname', '');
            $this->PhpMailer->Encoding = 'quoted-printable';
            $this->clear();
            $this->addHeader('Precedence', 'list');
            $this->addHeader('X-Auto-Response-Suppress', 'All');
            $this->setEmailTemplate(new EmailTemplate());
            $this->resolveFormat();
            parent::__construct();
        }

    or is it a different line?
  • @Dragnorian said:
    So how would I then set up my MX Record?

    @Dragnorian

    Would be better if you posted your PFH domain name or domain name you add on. We can tell you exactly what mx records to enter.

  • edited June 26

    @TheCrafters said:
    or is it a different line?

    I have it line 42. Looks like you have the syntax just a bit off.

    $this->PhpMailer->CharSet = c('Garden.Charset', 'utf-8');

  • edited June 26

    @badbot said:

    @TheCrafters said:
    or is it a different line?

    I have it line 42. Looks like you have the syntax just a bit off.

    $this->PhpMailer->CharSet = c('Garden.Charset', 'utf-8');

    $this->PhpMailer->CharSet = 'utf-8';
    It came that way by default.
    But I do have to say the newer version of Vanilla is a little confusing.

  • @TheCrafters said:

    @badbot said:

    @TheCrafters said:
    or is it a different line?

    I have it line 42. Looks like you have the syntax just a bit off.

    $this->PhpMailer->CharSet = c('Garden.Charset', 'utf-8');

    $this->PhpMailer->CharSet = 'utf-8';
    It came that way by default.
    But I do have to say the newer version of Vanilla is a little confusing.

    and it still puts out unformatted text that looks like this:

    Example Forum https://forum.example.com/index.php?p=3D=
    /=0ATest Email=0A=0AThis is a test email message.You can configure the appe=
    arance of your forum's emails by navigating to the Email page in the dashbo=
    ard.=0A=0ACheck it out: https://forum.example.com/index.php?p=3D/

    What could be causing this?
  • @TheCrafters
    My bad I checked installed copy of /library/core/class.email.php looks like line 46.

    $this->PhpMailer->Encoding = '8bit';

    Line 42 is $this->PhpMailer->CharSet = 'utf-8';

    Vanilla Forum version 2.5.1

  • @badbot said:

    @Dragnorian said:
    So how would I then set up my MX Record?

    @Dragnorian

    Would be better if you posted your PFH domain name or domain name you add on. We can tell you exactly what mx records to enter.

    my domain is nerdodevelopmenttesting

  • edited June 27

    @Dragnorian said:

    @badbot said:

    @Dragnorian said:
    So how would I then set up my MX Record?

    @Dragnorian

    Would be better if you posted your PFH domain name or domain name you add on. We can tell you exactly what mx records to enter.

    my domain is nerdodevelopmenttesting

    dot what?
    Your domain cannot be just nerdodevelopmenttesting!

  • @badbot said:
    @TheCrafters
    My bad I checked installed copy of /library/core/class.email.php looks like line 46.

    $this->PhpMailer->Encoding = '8bit';

    Line 42 is $this->PhpMailer->CharSet = 'utf-8';

    Vanilla Forum version 2.5.1

    I changed it to this:

    function __construct() {
            $this->PhpMailer = new \Vanilla\VanillaMailer();
            $this->PhpMailer->CharSet = 'utf-8';
            $this->PhpMailer->SingleTo = c('Garden.Email.SingleTo', false);
            $this->PhpMailer->Hostname = c('Garden.Email.Hostname', '');
            $this->PhpMailer->Encoding = '8bit';
            $this->clear();
            $this->addHeader('Precedence', 'list');
            $this->addHeader('X-Auto-Response-Suppress', 'All');
            $this->setEmailTemplate(new EmailTemplate());
            $this->resolveFormat();
            parent::__construct();
        }

    That seems to work just fine
  • @ChrisPAR said:

    @Dragnorian said:

    @badbot said:

    @Dragnorian said:
    So how would I then set up my MX Record?

    @Dragnorian

    Would be better if you posted your PFH domain name or domain name you add on. We can tell you exactly what mx records to enter.

    my domain is nerdodevelopmenttesting

    dot what?
    Your domain cannot be just nerdodevelopmenttesting!

    I think I found it http://nerdodevelopmenttesting.unaux.com/

  • @TheCrafters said:

    @ChrisPAR said:

    @Dragnorian said:

    @badbot said:

    @Dragnorian said:
    So how would I then set up my MX Record?

    @Dragnorian

    Would be better if you posted your PFH domain name or domain name you add on. We can tell you exactly what mx records to enter.

    my domain is nerdodevelopmenttesting

    dot what?
    Your domain cannot be just nerdodevelopmenttesting!

    I think I found it http://nerdodevelopmenttesting.unaux.com/

    I thought of it so, but we cannot be sure.

  • edited June 27

    Add these mx records in the control panel under MX Entry's

    nerdodevelopmenttesting.unaux.com >> mx.byetcluster.com.
    nerdodevelopmenttesting.unaux.com >> mx.unaux.com

    Both with priority of zero "0".

    After it propagates, your contact form script should start sending visitors message to your gmail account. It will be from the email address you have created [email protected]

    Then you should be able to alter the contact form script to best suit your needs.

  • edited June 27

    @badbot said:

    Add these mx records in the control panel under MX Entry's

    nerdodevelopmenttesting.unaux.com >> mx.byetcluster.com.
    nerdodevelopmenttesting.unaux.com >> mx.ezyro.com.

    Both with priority of zero "0".

    After it propagates, your contact form script should start sending visitors message to your gmail account. It will be from the email address you have created [email protected]

    Then you should be able to alter the contact form script to you best suit your needs.

    I do not think he will be able to add or change MX records for subdomain..
    I tried it and it didn't work.

  • @ChrisPAR said:

    @badbot said:

    Add these mx records in the control panel under MX Entry's

    nerdodevelopmenttesting.unaux.com >> mx.byetcluster.com.
    nerdodevelopmenttesting.unaux.com >> mx.ezyro.com.

    Both with priority of zero "0".

    After it propagates, your contact form script should start sending visitors message to your gmail account. It will be from the email address you have created [email protected]

    Then you should be able to alter the contact form script to you best suit your needs.

    I do not think he will be able to add or change MX records for subdomain..
    I tried it and it didn't work.

    Incorrect.
    I did it with my old domain
    GreenApplicationsofficial.ezyro.com which is now down.
    I now use GreenApplicationsOfficial.gq
    But he can use MX Records on subdomains. (Via CPanel)

  • edited June 27

    All we are doing is getting permission for the domain or sub domain to sendmail() via Apache.

    freemail.byetcluster.com [185.27.132.238]

  • @badbot said:

    Add these mx records in the control panel under MX Entry's

    nerdodevelopmenttesting.unaux.com >> mx.byetcluster.com.
    nerdodevelopmenttesting.unaux.com >> mx.unaux.com

    Both with priority of zero "0".

    After it propagates, your contact form script should start sending visitors message to your gmail account. It will be from the email address you have created [email protected]

    Then you should be able to alter the contact form script to best suit your needs.

    I did that, I added the domain with the mxentry and bytecluster and I tried to send an email but it never worked

  • edited June 28

    how long ago did you add mx entry? did you add both mx records? how was email sent, by webmail client in control panel?

    get email working from http://185.27.132.238/roundcubemail both send and receive. once that is working the contact form should work.

    If you can send and receive from webmail and not the contact form the script needs to be debugged.

    @Dragnorian

  • What is the port for freemail.byetcluster.com as SMTP server?
    I need to config this as my SMTP server for Vanilla Forums and port 587 doesn't work!

  • No smtp/pop/imap or SSL for free services.

    https://profreehost.com/support/email

  • @badbot said:
    No smtp/pop/imap or SSL for free services.

    https://profreehost.com/support/email

    Then, for what is freemail.byetcluster.com used?

  • @badbot said:
    how long ago did you add mx entry? did you add both mx records? how was email sent, by webmail client in control panel?

    get email working from http://185.27.132.238/roundcubemail both send and receive. once that is working the contact form should work.

    If you can send and receive from webmail and not the contact form the script needs to be debugged.

    @Dragnorian

    I really do not understand the whole MX Entry type thing, this is my first time dealing with this kind of thing, I have 3 entries one is of 1wt.unaux.com with byte cluster, the other two are:
    nerdodevelopmenttesting.unaux.com mx.unaux.com. 0
    nerdodevelopmenttesting.unaux.com mx.bytecluster.com. 0

  • I tried to send it through my website @badbot , I do not know my credentials for the roundcube

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!