You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 219 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - HOWTO: Send activation email using an outside SMTP server [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
disgruntledtech
Site Admin
Site Admin


Joined: Apr 14, 2003
Posts: 991

Location: Tulsa, OK

PostPosted: Fri Jan 23, 2004 12:40 am Reply with quoteBack to top

in mainfile.php before
Code:
function get_lang($module) {

add this:
Code:

//smtp email hack by Disgruntledtech
function mailviasmtp($user_email, $subject, $message, $headers){
global $board_config;
$board_config['smtp_host'] = "smtp.server.com";
$board_config['smtp_username'] = "username";
$board_config['smtp_password'] = "password";
$board_config['board_email'] = "whatever";
include("includes/smtp.php");
smtpmail($user_email, $subject, $message, $headers);
}


'board_email' in this example will show up as whatever@server.com


now to use this with any module inside nuke that uses the mail() command, can send mail through the specified server with a minor code change

open the following files and on or near the lines mentioned you'll see

Code:
mail(


change it to:
Code:
mailviasmtp(


/banners.php - lines 82 & 328
/modules/Feedback/index.php - line 93
/modules/Journal/friend.php - line 48
/modules/News/friend.php - line 77
/modules/Recommend_Us/index.php - line 54
/modules/Submit_News/index.php - line 252
/modules/Recommend_Us/index.php - line 54
/modules/Your_Account/index.php - lines 146 & 653 & 683
/admin/modules/links.php - line 1125
/admin/modules/newsletter.php - lines 123 & 150

that should do it.

tech note: i know board_config is setup in forum admin, but i decided to use 1 less sql query and hard code it.

EDIT: renamed email function to mailviasmtp since it conflicted with php-nuke tools module
Find all posts by disgruntledtechView user's profileSend private messageSend e-mailVisit poster's website
Eyecu
Nuke Cadet
Nuke Cadet


Joined: Feb 07, 2004
Posts: 3


PostPosted: Sat Feb 07, 2004 9:31 pm Reply with quoteBack to top

Hello
Ok i did all your said ^^^ and it fixed the one error i was getting but now i get an undefined function error on line 78 of smtp.php when I click on finish in the user registration process. The exact error is :

Fatal error: Call to undefined function: message_die() in D:\hshome\nvgaboon\lilfukker.net\PHP\includes\smtp.php on line 78

Im running 7.1. Any help would be appreciated!

Thank You
Wes Bullard
Find all posts by EyecuView user's profileSend private message
cclang
Nuke Cadet
Nuke Cadet


Joined: Feb 08, 2004
Posts: 2


PostPosted: Sun Feb 08, 2004 1:13 am Reply with quoteBack to top

I also added the lines posted above and am getting
Fatal error: Call to undefined function: message_die() in c:\program files\apache group\apache\htdocs\html\includes\smtp.php on line 41
when i click finish in the user registration page. Then i edited smtp.php like you said to do here -->
Quote:
it'd be easier to just edit smtp.php to get the error out in the open
Code:
message_die(GENERAL_ERROR, "Ran into problems sending Mail. Response: $server_response", "", $line, __FILE__);

to
Code:
//message_die(GENERAL_ERROR, "Ran into problems sending Mail. Response: $server_response", "", $line, __FILE__);
echo $server_response

and now im getting
Fatal error: Call to undefined function: smtpmail() in c:\program files\apache group\apache\htdocs\html\mainfile.php on line 235

Any help would be appreciated.
Oh Eyecu look at the bottom of this page since he had the same line error as you.
http://www.nukecops.com/postt20441.html
Find all posts by cclangView user's profileSend private message
disgruntledtech
Site Admin
Site Admin


Joined: Apr 14, 2003
Posts: 991

Location: Tulsa, OK

PostPosted: Sun Feb 08, 2004 2:11 am Reply with quoteBack to top

ok if you gotta have error handling try this:

remove the previous mods to mainfile.php

right above where you are calling mailviasmtp(
add
Code:
include('mailhack.php');


and create a file in the root called mailhack.php

Code:
<?php

//smtp email hack by Disgruntledtech

if (!function_exists('message_die')) {

   function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '') {
   echo "ERROR DUMP<BR>ERROR CODE ".$msg_code."<br>ERROR TEXT ".$msg_text."<br>ON LINE ".$err_line."<br>IN FILE ".$err_file."<br>";
   }
}


function mailviasmtp($user_email, $subject, $message, $headers){
global $board_config;
$board_config['smtp_host'] = "smtp.whatever.com";
$board_config['smtp_username'] = "username";
$board_config['smtp_password'] = "password";
$board_config['board_email'] = "who@whatever.com";
include("includes/smtp.php");
smtpmail($user_email, $subject, $message, $headers);
}

?>


the error dump isn't pretty but it gets the point across

Quote:
ERROR DUMP
ERROR CODE GENERAL_ERROR
ERROR TEXT Ran into problems sending Mail. Response: 550 Sender verify failed
ON LINE 40
IN FILE /home/voicesi/public_html/secretlab/includes/smtp.php
ERROR DUMP
ERROR CODE GENERAL_ERROR
ERROR TEXT Ran into problems sending Mail. Response: 503 valid RCPT command must precede DATA
ON LINE 40
IN FILE /home/voicesi/public_html/secretlab/includes/smtp.php
ERROR DUMP
ERROR CODE GENERAL_ERROR
ERROR TEXT Ran into problems sending Mail. Response: 500 unrecognized command
ON LINE 40
IN FILE /home/voicesi/public_html/secretlab/includes/smtp.php
Find all posts by disgruntledtechView user's profileSend private messageSend e-mailVisit poster's website
cclang
Nuke Cadet
Nuke Cadet


Joined: Feb 08, 2004
Posts: 2


PostPosted: Sun Feb 08, 2004 2:24 am Reply with quoteBack to top

Umm i havent tried this yet, but i fixed the error by following this fix
Code:
find the file "emailer.php" , about 237-240,

Code:

                        if ( !defined('SMTP_INCLUDED') )
                        {
                                include('includes/smtp.' . $phpEx);
                        }
 


modify the path of smtp.php:

Code:

                        if ( !defined('SMTP_INCLUDED') )
                        {
                                include('../../../includes/smtp.' . $phpEx);
                        }
 

which was for the mass emailer function in the forums. It sends the confirmation email and the activation email works, but now I am getting this error
Fatal error: Cannot redeclare server_parse() (previously declared in c:\program files\apache group\apache\htdocs\html\includes\smtp.php:29) in c:\program files\apache group\apache\htdocs\html\includes\smtp.php on line 29
I will try the new function, just letting you. Thanks for the quick response.
Find all posts by cclangView user's profileSend private message
EJ
Nuke Soldier
Nuke Soldier


Joined: Jan 08, 2004
Posts: 11


PostPosted: Thu Feb 12, 2004 12:38 pm Reply with quoteBack to top

Hello,
I'm having problem with my email function on my site.
The server is at home hosted by my isp cable.
running on windows 2000 server and PHPNUKE 6.9.
When users try to registered they dont get the activation on their email.
I have change all possible smtp still no luck.

Here's my site: http://www.rp.d2g.com

I followed the instructions, but now I'm getting

Code:
ERROR DUMP
ERROR CODE GENERAL_ERROR
ERROR TEXT Ran into problems sending Mail. Response: 533 5.7.1 AUTH command is not enabled.
ON LINE 164
IN FILE c:\inetpub\wwwroot\includes\smtp.php
ERROR DUMP
ERROR CODE GENERAL_ERROR
ERROR TEXT Ran into problems sending Mail. Response: 500 5.5.1 Unknown command "cnBjbGFuQG9wdG9ubGluZS5uZXQ=" specified
ON LINE 167
IN FILE c:\inetpub\wwwroot\includes\smtp.php
ERROR DUMP
ERROR CODE GENERAL_ERROR
ERROR TEXT Ran into problems sending Mail. Response: 500 5.5.1 Unknown command "MHJtb25kZQ==" specified
ON LINE 170
IN FILE c:\inetpub\wwwroot\includes\smtp.php
ERROR DUMP
ERROR CODE GENERAL_ERROR
ERROR TEXT Ran into problems sending Mail. Response: 554 5.5.0 No recipients have been specified.
ON LINE 226
IN FILE c:\inetpub\wwwroot\includes\smtp.php
ERROR DUMP
ERROR CODE GENERAL_ERROR
ERROR TEXT Ran into problems sending Mail. Response: 500 5.5.1 Unknown command "Subject: User Password for edwin" specified
ON LINE 242
IN FILE c:\inetpub\wwwroot\includes\smtp.php


Also where should I do this?
Quote:
EDIT: renamed email function to mailviasmtp since it conflicted with php-nuke tools module


Here's my mainfile.php look like with your code, is this correct?
Code:
} else {
   setcookie("lang",$language,time()+31536000);
   include("language/lang-$language.php");
   $currentlang = $language;
    }
}

//smtp email hack by Disgruntledtech
include('mailhack.php');

function get_lang($module) {
    global $currentlang, $language;
    if (file_exists("modules/$module/language/lang-$currentlang.php")) {
   if ($module == admin) {


Also I created mailhack.php in the root directory.

And still send mail doesn't work, either lost password or new user registration.

I use Outlook Express sending mail and receiving mail works.
Find all posts by EJView user's profileSend private messageVisit poster's website
EJ
Nuke Soldier
Nuke Soldier


Joined: Jan 08, 2004
Posts: 11


PostPosted: Thu Feb 12, 2004 1:59 pm Reply with quoteBack to top

I have to put back the codes the way it was before, because the forum is not working when I do your code.

Also when I do recommend us it with or without your code it does send email.

weird !!!

Please help
Find all posts by EJView user's profileSend private messageVisit poster's website
softwar
Nuke Cadet
Nuke Cadet


Joined: Feb 22, 2004
Posts: 6


PostPosted: Mon Mar 01, 2004 11:01 am Reply with quoteBack to top

I have the same error: ERROR DUMP... What's wrong? I did everything what was written.
Find all posts by softwarView user's profileSend private message
DamRipper
Nuke Soldier
Nuke Soldier


Joined: Mar 03, 2004
Posts: 11


PostPosted: Mon Mar 08, 2004 3:11 pm Reply with quoteBack to top

Thanks that fixed my problem but i didnt have to rename a module with version 7.0.
Find all posts by DamRipperView user's profileSend private message
nortonweb
Nuke Cadet
Nuke Cadet


Joined: Apr 18, 2004
Posts: 1


PostPosted: Sun Apr 18, 2004 8:27 pm Reply with quoteBack to top

Cheers disgruntledtech

totally sorted out my emailing problem

Most Cool

Pete
Find all posts by nortonwebView user's profileSend private message
Piratetrader
Nuke Soldier
Nuke Soldier


Joined: Mar 07, 2004
Posts: 17


PostPosted: Sat Apr 24, 2004 12:18 pm Reply with quoteBack to top

Eyecu wrote:
Hello
Ok i did all your said ^^^ and it fixed the one error i was getting but now i get an undefined function error on line 78 of smtp.php when I click on finish in the user registration process. The exact error is :

Fatal error: Call to undefined function: message_die() in D:\hshome\nvgaboon\lilfukker.net\PHP\includes\smtp.php on line 78

Im running 7.1. Any help would be appreciated!

Thank You
Wes Bullard


Same exact problem but did not see a answer to it.

Pirate

_________________
Image
Find all posts by PiratetraderView user's profileSend private messageMSN Messenger
pieceofpeace
Nuke Cadet
Nuke Cadet


Joined: Jun 13, 2004
Posts: 3


PostPosted: Wed Jun 16, 2004 1:27 pm Reply with quoteBack to top

I solved all my errors by using the smtpmail-function in each file listed above. It is defined in smtp.php.

Replace the mail() with smtpmail and it should work.
Right above that you should type in each file:
Code:
include('includes/smtp.php');


If you get an error indicating that the smtp-server isn't found,
edit your smtp.php in /includes/ like this:

Code:

// Replacement or substitute for PHP's mail command
function smtpmail($mail_to, $subject, $message, $headers = '')
{
        global $board_config;
//from here...
        $board_config['smtp_host'] = "smtp.server.domain";
        $board_config['smtp_username'] = "username";
        $board_config['smtp_password'] = "password";
        $board_config['board_email'] = "emailaddress";
//to here is what you have to add

        // Fix any bare linefeeds in the message to make it RFC821 Compliant.
        $message = preg_replace("#(?<!\r)\n#si", "\r\n", $message);


Some servers only accept emails when emailaddress is the email address connected to that username and password or at least
an email adress with .domain.
if this is stupid, don't flame me. don't know squad about php...
but it works for me.
Find all posts by pieceofpeaceView user's profileSend private message
confuxicated
Nuke Cadet
Nuke Cadet


Joined: Jul 15, 2004
Posts: 1


PostPosted: Wed Jul 14, 2004 8:13 pm Reply with quoteBack to top

i did what was said at the top by adding the mailsmtp( thing on all those pages and now when a user goes to signup they get this.

Code:
Warning: fsockopen(): php_network_getaddresse

help?
Find all posts by confuxicatedView user's profileSend private message
free69
Captain
Captain


Joined: Jan 18, 2003
Posts: 333

Location: Sniper Mobile Command

PostPosted: Sun Jul 25, 2004 3:28 pm Reply with quoteBack to top

Dear pieceofpeace,

I cannot find what makes redeclare message. Don't you have any clue?
=======================
I got below error ;
Fatal error: Cannot redeclare smtpmail() (previously declared in D:\xampp\htdocs\home\includes\smtp.php:29) in D:\xampp\htdocs\home\includes\smtp.php on line 198

where line 29 is

function smtpmail($mail_to, $subject, $message, $headers = '')
{ ... ... ......}

_________________
Image
Find all posts by free69View user's profileSend private messageSend e-mailVisit poster's websiteICQ Number
The_Phantom
Nuke Cadet
Nuke Cadet


Joined: Jul 30, 2004
Posts: 6

Location: Belper, UK

PostPosted: Fri Jul 30, 2004 2:20 pm Reply with quoteBack to top

Now then,
I've been battling with this problem for over a week, using PHPNuke 7.4, then 7.3, 7.2, and 7.1 running on Mandrake 9.1, PHP 4.2 and MySQL and had no luck with any of it, i tried every workaround, fix, hack and bodge in the book until today when i dug out an old version of 7.0 and used the mailhack include listed above.... and it now works a treat..
Thanks Disgruntledtech
Muhahaha
The Phantom Twisted Evil
Find all posts by The_PhantomView user's profileSend private messageVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
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 vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.048 Seconds - 102 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::