?
Solved

Perl breaking up URLs ???

Posted on 2006-05-26
14
Medium Priority
?
354 Views
Last Modified: 2010-03-05
I'm sending emails (i've tried MIME and SENDMAIL) both do the same on certain email clients...

I send an email with a link, and here below are some examples of the url breaking

http://server.com/email.html?i d=1148406418.46167
and
http://server.com/email! .html?id=1146681613.77319

weird how it stuck an ! in one, and put a space in both!?!?!

Any ideas, what could be causing this, the code looks fine. One person was on Groupwise, the other I'm not sure.
0
Comment
Question by:jmingo
13 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 16771150
How are you getting the link text?  reading from a text file? DB? hard coded?

Could you post the relevant code?

0
 

Author Comment

by:jmingo
ID: 16771291
thanks for the response. here is some of the code sending the email with link.

$r=time . '.' . $$  ;

my @mailnames=split(/ *, */,$email) ;
foreach(@mailnames) {

$emaillink = "http://server.com/email.html?id=$r";
$emaillinklow = "http://server.com/email.html?id=$r&highspeed=no";

$message = "<html><head><title>e-maill</title></head><style type=\"text/css\">body, td, input, select, textarea { font-size: 13px; font-family: Trebuchet MS,  Verdana, Arial, Sans-Serif; }</style><body bgcolor=#FFFFFF marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><table border=0 cellpadding=0 width=600 cellspacing=0><tr><td valign=top align=left><img src=\"http://server.com/images/$background.jpg\"></td></tr><tr><td valign=top align=left><table border=0 cellpadding=3 cellspacing=3><tr><td align=left valign=top>$newemailcontent<br><br><a href=\"$emaillink\"><b>$link</b></a><br><a href=\"$emaillinklow\"><b>$link - For Dial-up</b></a><br><br>$newsignature</body></html>";

open(SENDMAIL, "|$sendmail -t") || die "Unable to open sendmail";

print SENDMAIL "to: $_\n";
print SENDMAIL "from: $fromname <$fromemail>\n";
print SENDMAIL "Reply-to: $fromname <$fromemail>\n";
print SENDMAIL "Return-Path: $fromemail\n";
print SENDMAIL "MIME-Version: 1.0\n";
print SENDMAIL "subject: $subject\n";
print SENDMAIL "Content-Type: text/html; charset=us-ascii\n\n";
print SENDMAIL $message;
print SENDMAIL "\n\n";
close(SENDMAIL);
0
 

Author Comment

by:jmingo
ID: 16771725
Both users are using groupwise i have found out.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:Perl_Diver
ID: 16773266
print $message to the screen and see what it looks like before sending in the email.
0
 

Author Comment

by:jmingo
ID: 16773302
perl_diver: i'll try that.

if i email two people (for ex. me@here.com, them@groupwise.com)

me@here.com who uses outlook (no groupwise) will get it fine but the groupwise user will have the url broken up it seems.

so i'm quite sure its a groupwise thing.

any ideas??
0
 
LVL 8

Expert Comment

by:Perl_Diver
ID: 16776382
Are you reffering to Novell GroupWise? If so maybe that's where you should be asking this question:

http://www.experts-exchange.com/Applications/Groupwise/

If not, I don't undserstand what groupwise.com is besides a website which points to Novell's GroupWise Product information website. I can't see how perl has anything to do with this problem but maybe somenone else will.
0
 

Author Comment

by:jmingo
ID: 16780141
yes its novell group wise.. thanks, i'll ask the question there.
0
 
LVL 6

Expert Comment

by:nitinsawhney
ID: 16787771
Try using URI::Escape

use URI::Escape;

$safe_r = uri_escape($r);

$emaillink = "http://server.com/email.html?id=$safe_r";
$emaillinklow = "http://server.com/email.html?id=$safe_r" . '&highspeed=no';

Did you notice that second scalar $emaillinklow has been split into two parts. This is done as & is reserved operatior in perl and is used to call subroutines.

Hope this helps.

Cheers!!
0
 
LVL 8

Expert Comment

by:Perl_Diver
ID: 16787829
the & symbol has no special meaning in a double-quoted string, a little test shows that:

my $r = time . '.' . $$;
my $emaillinklow = "http://server.com/email.html?id=$r&highspeed=no";
print $emaillinklow;
0
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 16937847
jmingo,

Do you know if they are seeing an HTML formatted email or if they see the HTML code in their emails?
Also, you use $link in the $message scalar, what's the content of $link?
0
 

Author Comment

by:jmingo
ID: 16941551
i think the solution was to put some \r\n's in the code. what was happening i think is the code was just all strung together without any line feeds, so some servers were putting in line feeds and ! when it hits like 998 characters or something like that.
0
 

Author Comment

by:jmingo
ID: 17146221
solution provided above

thanks
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 17168368
Closed, 25 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question