Multiple E-Mail Addresses For Users

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
AGoodOlBoy
Registered User
Posts: 19
Joined: Sun Jul 27, 2003 1:23 pm

Multiple E-Mail Addresses For Users

Post by AGoodOlBoy » Mon Jul 28, 2003 4:42 am

Have a user who wants to utilize two e-mail addresses for his mass mailings.
Will this work - -> insert both in the form separated by a comma? i.e.
'user@site1.com', 'user@site2.com'

User avatar
primedomain
Former Team Member
Posts: 25944
Joined: Sat Dec 15, 2001 10:23 am

Post by primedomain » Mon Jul 28, 2003 10:26 am

I don't think so (but I haven't tested it). I am not sure if I understand why he wants two email addresses... he could register a second time with his second email address?

moving from Support to MODs.

AGoodOlBoy
Registered User
Posts: 19
Joined: Sun Jul 27, 2003 1:23 pm

You Asked Why

Post by AGoodOlBoy » Tue Jul 29, 2003 3:28 am

I have several Users on my forum that want to have any e-mails sent to several addresses, i.e., work & home. Thus, the request if this is possible.

Thanx

Bert The Weird
Registered User
Posts: 136
Joined: Sat Feb 01, 2003 1:42 pm
Location: UK
Contact:

Post by Bert The Weird » Tue Jul 29, 2003 5:40 pm

i think that this is a good idea, you could have options to set that pm notifications go to an address or both etc.

dennistt
Registered User
Posts: 271
Joined: Sat May 10, 2003 12:06 am
Location: DennisTT.Net
Contact:

Post by dennistt » Wed Jul 30, 2003 3:06 am

primedomain wrote: I don't think so (but I haven't tested it). I am not sure if I understand why he wants two email addresses... he could register a second time with his second email address?

moving from Support to MODs.


I think this would be a better idea since you need more columns in your phpBB if you have more emails (or am I wrong?)

User avatar
MW4
Registered User
Posts: 112
Joined: Sat May 03, 2003 11:03 pm

I need this too

Post by MW4 » Thu Sep 23, 2004 9:46 pm

I think this should be a mod.

I don't want to have multiple users with different e-mails, I want one user with two (or three) e-mail addresses to send to ie: Home and Work.

If the guy was a mod, I'd have to set him up twice, etc.

You can do it in other programs with just a comma or semi colon, it would seem like a minor issue.

Can any of you high tech guys out there figure this one out?

User avatar
MW4
Registered User
Posts: 112
Joined: Sat May 03, 2003 11:03 pm

Anyone?

Post by MW4 » Sat Sep 25, 2004 6:15 am

Does anyone have a thought on this?

brakkums
Registered User
Posts: 4
Joined: Fri Oct 10, 2003 4:31 pm

Post by brakkums » Thu Dec 02, 2004 9:44 pm

This seems to be somewhat common, as my search for this turned up several results. I too would like to be able to do this on my site. Does anyone have any ideas on this?

MrTorrance
Registered User
Posts: 92
Joined: Thu Nov 18, 2004 10:41 pm
Location: Idaho
Contact:

I test out 2 emails and it doesn't work

Post by MrTorrance » Thu Dec 02, 2004 10:40 pm

Tried using 2emails seperated by a , but the smtp.php include errored out.

I was thinking a little and it seems like you could modify the admin_mass_email.php file to take a second set of addresses. Then you could simply add another feild to the profile area and user_email in mysql areas.

If i can get this other mod Im working with to freakin work. I might try doing something like this this weekend. It seems like a common problem. Heck, most everyone I know has a couple email addresses.
~MrsTorrance~
~Wife's Blog~
...it must be that darn flux capacitor again!?
[DEV]CC_2ND_EMAIL : [DEV]WordLinks

MrTorrance
Registered User
Posts: 92
Joined: Thu Nov 18, 2004 10:41 pm
Location: Idaho
Contact:

I think I got it...I need help though?

Post by MrTorrance » Fri Dec 03, 2004 12:03 am

having problems with the darkblue area. If I switch positions of bcc section for cc section it emails to the top position. How do I write this so it will mail to both without an error.

I didn't mod any other files...I'm using the cc portion of the mailer funciton and added the user_email2 to the user table. AND IT WORKS..sort of. I have not worked on the user entry portions yet, i just added the second addresses through phpMyAdmin.
<?php
admin_mass_email.php


$group_id = intval($HTTP_POST_VARS[POST_GROUPS_URL]);
// MOD 2nd Email cc ADDED u.user_email2 to Table
$sql = ( $group_id != -1 ) ? "SELECT u.user_email, u.user_email2 FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email, user_email2 FROM " . USERS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select group members', '', __LINE__, __FILE__, $sql);
}

if ( $row = $db->sql_fetchrow($result) )
{

// MOD Email 2nd using cc
$cc_list = array();
do
{
$cc_list[] = $row['user_email2'];
}
while ( $row = $db->sql_fetchrow($result) );
// END MOD email 2nd using cc

$bcc_list = array();
do
{
$bcc_list[] = $row['user_email'];
}
while ( $row = $db->sql_fetchrow($result) );

$db->sql_freeresult($result);
}
else
{
$message = ( $group_id != -1 ) ? $lang['Group_not_exist'] : $lang['No_such_user'];
$error = true;
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $message : $message;
}


if ( !$error )
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);

//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery'])
{
$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';

// We are running on windows, force delivery to use our smtp functions
// since php's are broken by default
$board_config['smtp_delivery'] = 1;
$board_config['smtp_host'] = @$ini_val('SMTP');
}

$emailer = new emailer($board_config['smtp_delivery']);

$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);

// MOD 2nd Email
for ($i = 0; $i < count($cc_list); $i++)
{
$emailer->cc($cc_list[$i]);
}

// END MOD 2nd Email


for ($i = 0; $i < count($bcc_list); $i++)
{
$emailer->bcc($bcc_list[$i]);
}
Last edited by MrTorrance on Fri Dec 03, 2004 3:55 am, edited 1 time in total.
~MrsTorrance~
~Wife's Blog~
...it must be that darn flux capacitor again!?
[DEV]CC_2ND_EMAIL : [DEV]WordLinks

MrTorrance
Registered User
Posts: 92
Joined: Thu Nov 18, 2004 10:41 pm
Location: Idaho
Contact:

I may have found a solution to 2 emails :-)

Post by MrTorrance » Fri Dec 03, 2004 3:38 am

I get home from work, look at the file for a few minutes and Uereka! Multiple email using bcc.

ADMIN_MASS_EMAIL.PHP
if ( empty($message) )
{
$error = true;
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
}

$group_id = intval($HTTP_POST_VARS[POST_GROUPS_URL]);
//MOD EMAIL2
$sql = ( $group_id != -1 ) ? "SELECT u.user_email
, u.user_email2 FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email, user_email2 FROM " . USERS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select group members', '', __LINE__, __FILE__, $sql);
}

if ( $row = $db->sql_fetchrow($result) )
{
$bcc_list = array();
do
{
$bcc_list[] = $row['user_email2'];
//MOD EMAIL2

$bcc_list[] = $row['user_email'];
}
while ( $row = $db->sql_fetchrow($result) );

$db->sql_freeresult($result);
}


SQL-query:

Code: Select all

ALTER TABLE `phpbb_users` ADD `user_email2` VARCHAR( 255 ) AFTER `user_email` ;

profile_add_body.tpl
<td class="row1"><span class="gen">{L_EMAIL_ADDRESS}: *</span></td>
<td class="row2"><input type="text" class="post" style="width:200px" name="email" size="25" maxlength="255" value="{EMAIL}" /></td>
</tr>
// MOD EMAIL2
<tr>
<td class="row1"><span class="gen">{L_EMAIL_ADDRESS} 2: *</span></td>
<td class="row2"><input type="text" class="post" style="width:200px" name="email2" size="25" maxlength="255" value="{EMAIL2}" /></td>
</tr>
// END MOD EMAIL2

<!-- BEGIN switch_edit_profile -->
<tr>
<td class="row1"><span class="gen">{L_CURRENT_PASSWORD}: *</span><br />
Last edited by MrTorrance on Fri Dec 03, 2004 4:02 am, edited 1 time in total.
~MrsTorrance~
~Wife's Blog~
...it must be that darn flux capacitor again!?
[DEV]CC_2ND_EMAIL : [DEV]WordLinks

MrTorrance
Registered User
Posts: 92
Joined: Thu Nov 18, 2004 10:41 pm
Location: Idaho
Contact:

continued EMAIL2

Post by MrTorrance » Fri Dec 03, 2004 3:52 am

For some reason I couldn't post the USERCP_REGISTER.PHP file. You may download it from my site if you'd like. All changes were marked with the // MOD EMAIL2...i did such and such

DOWNLOAD ZIP(10K)

A NOTE TO ALL:
I am a novice and in no way can I attempt to provide tech support or know what the heck your talking about. So please have mercy on me, this is my real first attempt at a MOD and in no way do I assume responsibility for screwed up forums. It's working great on mine. I've tested it with 3 user accounts and 3 diff emails using mass mail.
Thanks and Good day.


THIS MODIFICATION IS STRICTLY FOR TESTING
~MrsTorrance~
~Wife's Blog~
...it must be that darn flux capacitor again!?
[DEV]CC_2ND_EMAIL : [DEV]WordLinks

MrTorrance
Registered User
Posts: 92
Joined: Thu Nov 18, 2004 10:41 pm
Location: Idaho
Contact:

Added cc to profile emailer...

Post by MrTorrance » Fri Dec 03, 2004 5:03 pm

I added CC of 2nd email address in the main profile mailer. Now users will get a carbon copy sent to second email address anytime someone mails them. I'm not quite sure how to make this optional for users. I could see this being a pain if all you want are the mass emails sent to both addresses and not the user-to-user emails. Anyway here it is:

USERCP_EMAIL.PHP
.begining of file
.
.
// MOD EMAIL2 added user_email2 to query
$sql = "SELECT username, user_email
, user_email2, user_viewemail, user_lang
FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
if ( $result = $db->sql_query($sql) )
{
$row = $db->sql_fetchrow($result);

$username = $row['username'];
$user_email = $row['user_email'];

$user_email2 = $row['user_email2'];
// END MOD EMAIL2
$user_lang = $row['user_lang'];

if ( $row['user_viewemail'] || $userdata['user_level'] == ADMIN )
{
if ( time() - $userdata['user_emailtime'] < $board_config['flood_interval'] )
{
message_die(GENERAL_MESSAGE, $lang['Flood_email_limit']);
}

if ( isset($HTTP_POST_VARS['submit']) )
{
$error = FALSE;

if ( !empty($HTTP_POST_VARS['subject']) )
{
$subject = trim(stripslashes($HTTP_POST_VARS['subject']));
}
else
{
$error = TRUE;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
}

if ( !empty($HTTP_POST_VARS['message']) )
{
$message = trim(stripslashes($HTTP_POST_VARS['message']));
}
else
{
$error = TRUE;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
}

if ( !$error )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_emailtime = " . time() . "
WHERE user_id = " . $userdata['user_id'];
if ( $result = $db->sql_query($sql) )
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);

$emailer->from($userdata['user_email']);
$emailer->replyto($userdata['user_email']);

$email_headers = 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";

$emailer->use_template('profile_send_email', $user_lang);
$emailer->email_address($user_email);
// MOD EMAIL2
$emailer->cc($user_email2);// END MOD EMAIL2
.
.
.rest of file
~MrsTorrance~
~Wife's Blog~
...it must be that darn flux capacitor again!?
[DEV]CC_2ND_EMAIL : [DEV]WordLinks

publicslam
Registered User
Posts: 92
Joined: Thu Sep 02, 2004 5:37 pm

Post by publicslam » Fri Dec 03, 2004 6:37 pm

The simplest way is just 2 make them create another account with the ohter email and than just send the mass mail 2 all and it will send it 2 both email address. Its simply as that :P :twisted:

http://www.publicslam.com
public slam

MrTorrance
Registered User
Posts: 92
Joined: Thu Nov 18, 2004 10:41 pm
Location: Idaho
Contact:

Post by MrTorrance » Tue Dec 21, 2004 12:04 am

NOW IN MOD DEVELOPMENT -- LINK
~MrsTorrance~
~Wife's Blog~
...it must be that darn flux capacitor again!?
[DEV]CC_2ND_EMAIL : [DEV]WordLinks

Post Reply

Return to “[2.0.x] MOD Requests”