Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

How to change the smtp server settings for Sending Emails

Post Reply
mateo
Posts: 10
Joined: Thu Feb 17, 2011 3:53 pm

How to change the smtp server settings for Sending Emails

Unread post by mateo »

Hello,

I'm new to nuBuilder...

I just want to know what is the right way to change the smtp server settings so I can use the "emailIt" Javascript function?

I tried to open "emaillib.php" and I found 3 "NuMailMethods" being used, how do I know which is the default method
being used? Can I change it? How? Can I invoke the "emailIt" function in the Special Action Button?

Need some help please... Tnx!

Rgds,
Mateo
csnet
Posts: 11
Joined: Wed Sep 29, 2010 8:13 pm

Re: How to change the smtp server settings for Sending Emails

Unread post by csnet »

Hi Mateo,
To Configure your SMTP server on nuBuilder, just edit the following file: ..\productionnu2\config.php :
$NUMailMethod = "smtp";
$NUSMTPHost = "your smtp server";
$NUSMTPUsername = "your smtp username";
$NUSMTPPassword ="your smtp password";

And yes, you can use emailit in the JavaScript area of your "extra action button"
Hope it helps,
mateo
Posts: 10
Joined: Thu Feb 17, 2011 3:53 pm

Re: How to change the smtp server settings for Sending Emails

Unread post by mateo »

hello csnet!

thanks a lot for your response.

i changed the ff. global variables in config.php:

$NUMailMethod = "smtp";
$NUSMTPUsername = "mycompanyemailaddress";
$NUSMTPPassword = "mypassword";
$NUSMTPHost = "ip address of our smtp server";
$NUSMTPPort = 25;

but still no success. :(

i tried to test the values i placed above using ...../phpmailer-5.1/examples/test_smtp_advanced.php
and it worked successfully...

i compared emaillib.php with test_smtp_advanced.php and both of them used the same base class "class.phpmailer.php"

am i missing something?
shane
Posts: 100
Joined: Mon Jun 15, 2009 10:04 am

Re: How to change the smtp server settings for Sending Emails

Unread post by shane »

You only need to put a username and password in these fields if you are connecting to an authenticated SMTP server, otherwise these fields should be commented out.
//$NUSMTPUsername = "";
//$NUSMTPPassword = "";
Are you using your own SMTP server or a server provided to you from either your ISP or web-hosting provider?
Can you telnet to your SMTP server?
mateo
Posts: 10
Joined: Thu Feb 17, 2011 3:53 pm

Re: How to change the smtp server settings for Sending Emails

Unread post by mateo »

There is no problem with the SMTP settings, I have tested it well
to make sure my focus is on how to make it work in nuBuilder.

I found the "emailsendIt" function in form.php, still trying to figure out though
how it makes use of the global variables I set in config.php (see 3rd thread)

I just want to make the sending of reports thru email work by defining a custom
SMTP settings.

Any input will sure help. Thanks very much!!! :D
mateo
Posts: 10
Joined: Thu Feb 17, 2011 3:53 pm

Re: How to change the smtp server settings for Sending Emails

Unread post by mateo »

OK, after trying to debug, I am getting a NULL cookie value inside this
function that is being used when you send a report by email:

File: form.php

function emailSendResponse() {
// Get the cookie and delete it.
cookieValue = nuReadCookie("emailREPORT");

//++++++++++++ I tried to popout the value of the variable by using the alert function in JavaScript and I am getting a NULL value
alert(cookieValue);

nuEraseCookie("emailREPORT");
// Check the cookie value.

switch (cookieValue)
{
// The cookie has this value if everything was successful.
case "{$this->formsessionID}":
emailSuccess();
return true;
// The report could not be generated...
// NOTE: This case won't run if there was an error in the report
// itself, only if the report URL could not be read from or
// the report document could not be saved to the filesystem.
case "report_error":
emailFailure("There was an error generating the report");
return false;
// The email was not sent successfully...
// NOTE: This will mostly like only occur if the report could not
// be attached or there is no SMTP server listening on port 25.
// Postfix will just add the message to a queue before it trys
// to send the message, so invalid hostnames and users will
// not trigger this error.
case "email_error":
emailFailure("There was an error sending the email");
return false;
// This case will run if for some reason reportemail.php died
// before sendResponse() was called. In other words, no cookie.
default:
//++++++++++++ I am landing in this default error
emailFailure("There was an error sending the email");
return false;
} // switch
} // function

Any idea? tips? clues? guidance? Thanks in advance...

Rgds,
Mateo
shane
Posts: 100
Joined: Mon Jun 15, 2009 10:04 am

Re: How to change the smtp server settings for Sending Emails

Unread post by shane »

If you are running on a Linux host, one thing I would suggest is the make sure that you have write permissions to the following

{webroot}/productionnu2/temppdf

chmod it to 775
and chown it to either apache:apache or nobody:nobody depending what your webserver runs as.

Let me know is this doesn't work
mateo
Posts: 10
Joined: Thu Feb 17, 2011 3:53 pm

Re: How to change the smtp server settings for Sending Emails

Unread post by mateo »

Hi Shane!

Thanks for the tip but I'm using nuBuilder on Windows XP.

I checked the folder security permission of {webroot}/productionnu2/temppdf
and everything is ok, I have the write permission.

Can you give me some tips in troubleshooting, I'm stuck on that cookie "emailREPORT"
that appears NULL, is there some settings that I should add in config.php?

Thanks for your help.

By the way, when I'm done, I will deploy my project on a Linux server.

Rgds,
Mateo
mateo
Posts: 10
Joined: Thu Feb 17, 2011 3:53 pm

Re: How to change the smtp server settings for Sending Emails

Unread post by mateo »

Yes, it's working now. I reviewed the installation instructions again
and found out the CURL is not enabled in my php.ini settings.

CURL is required for the sending of emails to work.

Thanks Shane and csnet for paying attention to my post.

nuBuilder is fantastic! :D
shane
Posts: 100
Joined: Mon Jun 15, 2009 10:04 am

Re: How to change the smtp server settings for Sending Emails

Unread post by shane »

I'm glad to see the problem is solved, good luck with using nuBuilder
Post Reply