Topic: reformatting e-mail addresses

Okay here's my problem... according to my web-host, e-mails sent WITHIN my domain must be formatted a certain way for them to be sent (i.e.  user%mydomain.com@hostdomain.com)

Obviously, I ran into trouble with the forum because I can't use the same domain for e-mails as I use for the forum... follow so far?

As workaround, my host suggests entering the special format in profiles of members from my domain.  This works but is annoying a) some of my members with my domain addresses aren't very techie and ar easily confused...  b) the addresses are displayed to all forum users in the special format.

What I need...
Special code (in email.php, I presume) to automatically check for a specific domain and reformat the address appropriately.

alternatively, some code to display addresses from a specific domain differently (this is presumably easier but less helpful because my users would still have to know the special format.)

Find what you want...  Where you want it... www.truelocal.com

Re: reformatting e-mail addresses

Then I would call this a mod request and not troubleshooting :D I'll move the topic.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3 (edited by Cailean 2004-03-18 23:25)

Re: reformatting e-mail addresses

I put it in troubleshooting because I figured it was a fairly unique problem.  I tend to think of Mods as things that everyone might use.  Your forum, your call! wink

Find what you want...  Where you want it... www.truelocal.com

Re: reformatting e-mail addresses

You're right. However, I try to keep everything related to code modifications in the mod section.

Could you give us an example of how you want the addresses converted before PunBB attempts to send them?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: reformatting e-mail addresses

Fair enough...  Any thoughts on the problem?

Find what you want...  Where you want it... www.truelocal.com

Re: reformatting e-mail addresses

Read the second paragraph in my previous post :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: reformatting e-mail addresses

my e-mail address as forum admin is 'forum_admin@musicamp.ca' but my web-host requires that it be formatted as 'forum_admin%musicamp.ca@dpmail05.doteasy.com' because it's being sent within the server (at least I think that's why...)
I don't know what PHP's text manipulation features are but it would something along the lines of:

when emailing...
if an address contains '@musicamp.ca', cut that and replace it with '%musicamp.ca@dpmail05.doteasy.com' before sending.

Is something like this possible?

Find what you want...  Where you want it... www.truelocal.com

Re: reformatting e-mail addresses

Ok, try this. Open up email.php and look up the function pun_mail. There, after the line that starts with "global", add the following lines:

if (strpos($to, '@musicamp.ca') !== false)
    $to = str_replace('@', '%', $to).'@dpmail05.doteasy.com';

That should do it.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: reformatting e-mail addresses

ok, I'll try it...  but just so I understand what's happening:

the first line looks for the '@musicamp.ca' and if it's there the second line replaces '@' with '%' and tacks on '@dpmail', etc.

should work!!

Find what you want...  Where you want it... www.truelocal.com

Re: reformatting e-mail addresses

excellent!!  Works like a charm!  If only my web-host support guys were so helpful!!!

Thanks, again.

Find what you want...  Where you want it... www.truelocal.com

Re: reformatting e-mail addresses

Cailean wrote:

ok, I'll try it...  but just so I understand what's happening:

the first line looks for the '@musicamp.ca' and if it's there the second line replaces '@' with '%' and tacks on '@dpmail', etc.

Exactly :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."