Link to home
Start Free TrialLog in
Avatar of jmingo
jmingo

asked on

Perl breaking up URLs ???

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.
Avatar of Adam314
Adam314

How are you getting the link text?  reading from a text file? DB? hard coded?

Could you post the relevant code?

Avatar of jmingo

ASKER

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);
Avatar of jmingo

ASKER

Both users are using groupwise i have found out.
print $message to the screen and see what it looks like before sending in the email.
Avatar of jmingo

ASKER

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??
Are you reffering to Novell GroupWise? If so maybe that's where you should be asking this question:

https://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.
Avatar of jmingo

ASKER

yes its novell group wise.. thanks, i'll ask the question there.
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!!
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;
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?
Avatar of jmingo

ASKER

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.
Avatar of jmingo

ASKER

solution provided above

thanks
ASKER CERTIFIED SOLUTION
Avatar of GhostMod
GhostMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial