Current location: Hot Scripts Forums » Programming Languages » Perl » URL is not showing on email message


URL is not showing on email message

Reply
  #1 (permalink)  
Old 06-28-07, 02:46 AM
sujata_ghosh sujata_ghosh is offline
Wannabe Coder
 
Join Date: May 2006
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
URL is not showing on email message

Hi to all!

a CGI script is takeing data from a Form and sending email using that the form message text box containing this:

Code:
Dear Sir/Madam,
After a long time we have come out with a new edition of While You were Trading which is attached along with this mail. You can also view it here http://www.k****ij.com/research/whil...ng/index.shtml
To take a look at how Asian Currencies are expected to perform in the forcible future click here http://www.k****ij.com/research/usdkrw.shtml
To download the PDF version of the report you can click here
http://www.k****ij.com/research/Asian Currencies June07.pdf
the last URL is like that: http://www.k****ij.com/research/Asian Currencies June07.pdf

which whole part is not beging linkable on text or HTML email.

i have set the varaiable for HTML mail as follows:

$message = $INPUT{'message'};
$messtext = $INPUT{'message'};

($messhtml = $message) =~ s/(\w+\@\w+\.\w+)/<a href=\"<A href="mailto:$1\">$1<\/a>/g">mailto:$1\">$1<\/a>/g;
$messhtml =~ s/(\w+:\/\/)([.a-zA-Z0-9\-~\/\_\/\?\/\=\/]*)/<a href=\"$1$2\">$1$2<\/a>/g;

$messtext is for text mail and $messhtml for HTML email i am using but that space is not converted properly and only this part 'http://www.k****ij.com/research/Asian' is clickable rest 'Currencies June07.pdf' is not.

please help me out!
Reply With Quote
  #2 (permalink)  
Old 06-28-07, 01:38 PM
curbview.com's Avatar
curbview.com curbview.com is offline
Junior Code Guru
 
Join Date: May 2006
Posts: 555
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sujata_ghosh View Post
Hi to all!

a CGI script is takeing data from a Form and sending email using that the form message text box containing this:

Code:
Dear Sir/Madam,
After a long time we have come out with a new edition of While You were Trading which is attached along with this mail. You can also view it here http://www.k****ij.com/research/whil...ng/index.shtml
To take a look at how Asian Currencies are expected to perform in the forcible future click here http://www.k****ij.com/research/usdkrw.shtml
To download the PDF version of the report you can click here
http://www.k****ij.com/research/Asian Currencies June07.pdf
the last URL is like that: http://www.k****ij.com/research/Asian Currencies June07.pdf

which whole part is not beging linkable on text or HTML email.

i have set the varaiable for HTML mail as follows:

$message = $INPUT{'message'};
$messtext = $INPUT{'message'};

($messhtml = $message) =~ s/(\w+\@\w+\.\w+)/<a href=\"<A href="mailto:$1\">$1<\/a>/g">mailto:$1\">$1<\/a>/g;
$messhtml =~ s/(\w+:\/\/)([.a-zA-Z0-9\-~\/\_\/\?\/\=\/]*)/<a href=\"$1$2\">$1$2<\/a>/g;

$messtext is for text mail and $messhtml for HTML email i am using but that space is not converted properly and only this part 'http://www.k****ij.com/research/Asian' is clickable rest 'Currencies June07.pdf' is not.

please help me out!
Your regex is too greedy. Check you mail / PM box for a solution.
Reply With Quote
  #3 (permalink)  
Old 06-28-07, 01:39 PM
Drunken Perl Coder Drunken Perl Coder is offline
Wannabe Coder
 
Join Date: Aug 2006
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
You have spaces in a filename/URL? That in itself is not a good idea. Rename the file:

Asian_Currencies_June07.pdf

and it should work.
__________________
Mods: Please do not edit my posts to add syntax highlighting. Thank you.
Reply With Quote
  #4 (permalink)  
Old 06-28-07, 01:46 PM
curbview.com's Avatar
curbview.com curbview.com is offline
Junior Code Guru
 
Join Date: May 2006
Posts: 555
Thanks: 0
Thanked 0 Times in 0 Posts
Besides the regex I sent you, you would want to scrub your user input from rogue visitors. The spaces in the URL are not really spaces...Line breaks and or high ASCII valued characters will ruin your regex.
Reply With Quote
  #5 (permalink)  
Old 06-29-07, 08:26 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
Quote:
Originally Posted by curbview.com View Post
Your regex is too greedy. Check you mail / PM box for a solution.
That's not how it works on this forum
If you want to help people, post your solutions in the topic, so other people can anticipate on your solution.
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #6 (permalink)  
Old 06-29-07, 08:39 AM
sujata_ghosh sujata_ghosh is offline
Wannabe Coder
 
Join Date: May 2006
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks guys for your help!

that means if my url have any space it won't work?? why?

if we write some url with space it converted the space into '20%'

i don;t know how to track space using regex.

can't i do that at here? instead of do that "Asian_Currencies_June07.pdf"???

see its not user input its file which we are sending to client insteade of attachemnet to download it. we have used it on site also. so that means we need to make each file with types to use it on email and one on website!!!!!
Reply With Quote
  #7 (permalink)  
Old 06-29-07, 09:45 AM
curbview.com's Avatar
curbview.com curbview.com is offline
Junior Code Guru
 
Join Date: May 2006
Posts: 555
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by UnrealEd View Post
That's not how it works on this forum
If you want to help people, post your solutions in the topic, so other people can anticipate on your solution.
I would post code here on the forum, BUT the only tag I see to wrap code in is PHP I don't see one to wrap/format Perl code. Perhaps that is a suggestion/ability worth adding to the forum?
Reply With Quote
  #8 (permalink)  
Old 06-29-07, 05:28 PM
Drunken Perl Coder Drunken Perl Coder is offline
Wannabe Coder
 
Join Date: Aug 2006
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sujata_ghosh View Post
Thanks guys for your help!

that means if my url have any space it won't work?? why?

if we write some url with space it converted the space into '20%'

i don;t know how to track space using regex.

can't i do that at here? instead of do that "Asian_Currencies_June07.pdf"???

see its not user input its file which we are sending to client insteade of attachemnet to download it. we have used it on site also. so that means we need to make each file with types to use it on email and one on website!!!!!
Why can't you just properly rename the file to Asian_Currencies_June07.pdf? Spaces in filenames is OK on your local windows PC but you should not use them for files you post on the internet.
__________________
Mods: Please do not edit my posts to add syntax highlighting. Thank you.
Reply With Quote
  #9 (permalink)  
Old 06-29-07, 05:52 PM
Drunken Perl Coder Drunken Perl Coder is offline
Wannabe Coder
 
Join Date: Aug 2006
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
Try this, might need tweaking but that's up to you to figure out:

Code:
$messhtml = q~Dear Sir/Madam,
After a long time we have come out with a new edition of While You were Trading which is attached along with this mail. You can also view it here http://www.example.com/research/whilng/index.shtml
To take a look at how Asian Currencies are expected to perform in the forcible future click here http://www.example.com/research/usdkrw.shtml
To download the PDF version of the report you can click here
http://www.example.com/research/Asian Currencies June07.pdf~;

$messhtml =~ s#(http://[.\w/]+/(?:\w+\s*\w+)+\.\w{3,5}\b)#<a href="$1">$1</a>#sg;

print $messhtml;
__________________
Mods: Please do not edit my posts to add syntax highlighting. Thank you.
Reply With Quote
  #10 (permalink)  
Old 06-30-07, 12:39 AM
Christian's Avatar
Christian Christian is offline
Community VIP
 
Join Date: Mar 2005
Location: ProgrammingTalk
Posts: 2,449
Thanks: 0
Thanked 6 Times in 5 Posts
Quote:
Originally Posted by curbview.com View Post
Perhaps that is a suggestion/ability worth adding to the forum?
[highlight=perl][/highlight] OR [code][/code]

__________________
:: ImperialBB :: New version in the works! :: http://www.imperialbb.com ::

:: Have a question about the board? The Rules? An Infraction/Warning? :: Contact Form ::
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help to create a attachment on my email frankkk PHP 1 10-25-04 02:10 PM
email hidding in message usman PHP 1 09-18-03 03:27 AM


All times are GMT -5. The time now is 04:47 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.