Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 502
  • Last Modified:

Carriage returns in long URL when using xp_sendmail

I'm sending out an automated email using xp_sendmail. Included in the message body is a URL. I have put a break before the URL so it starts at the beginning of the line, but it still spans 2 lines.  There seems to be a carriage return or something inserted in the middle of the link after the 78th character so that when users click on it, part of the link is cut off...

eg.

http://www.somewhere.org/nonsensical/whereever.html                     --turns into

http://www.somewhere.org/nonse
nsical/whereever.html

so that only the top part is hyperlinked.

This seems to happen right after the 78th character. Is there some way to get the URL to keep together, or break across 2 lines without breaking? Changing the URL is not really an option.
0
yogic_flyer
Asked:
yogic_flyer
  • 3
  • 3
  • 3
  • +1
3 Solutions
 
crescendoCommented:
From books online for xp_sendmail:

[@width =] width

Is an optional parameter setting the line width of the output text for a query. This parameter is identical to the /w parameter in the isql utility. For queries producing long output rows, use width with attach_results to send the output without line breaks in the middle of output lines. The default width is 80 characters.

OK, so it says it's for queries, but have you tried it anyway?
0
 
arbertCommented:
Have you played with the @width parameter to see if you can stop it from wrapping?  Post your xp_sendmail code...
0
 
SoftEng007Commented:
in thr body change the url to a href

ie.

<a href="your long url here" >short message here</a>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
arbertCommented:
You can't do that--XP_Sendmail won't send HTML--it just gets converted to plain text....
0
 
SoftEng007Commented:
oops, sorry for the mis information. I use smtp mail and keep fogetting about the sendmail limits..
0
 
arbertCommented:
Yep, I use smtp as well just because of the HTML thing--Yukon will make our lives much better with email...
0
 
yogic_flyerAuthor Commented:
Sorry about the late comment.
Anyway, I have tried @width and no, it doesn't seem to work on the text body. It's kind of frustrating because it makes the URLs I've included in the mail useless. Any other alternatives? I tried CDOSYS but most likely due to some administrative settings, (that I have no access to) I cannot use it - fails when it tries to create objects.
Any other ideas and/or alternatives?  Is smtp mail a viable solution? Would there be additional components to install? Generally, I think additional installations are frowned upon...
Almost forgot, the xp_sendmail code is below:

CREATE PROCEDURE dbo.SendSummaryMail

AS
            DECLARE @Administrator AS VARCHAR(10)
                        
            SELECT @Administrator = UserMail
            FROM Administrators
            WHERE AdminPosition = 'Administrator'
            
            DECLARE @ApplicationRoot AS VARCHAR(200)
            SELECT @ApplicationRoot = FieldValue
            FROM ApplicationAdminValues
            WHERE FieldName = 'RootPath'
            
            DECLARE @MailBody AS VARCHAR(500)
            DECLARE @MailTo AS VARCHAR(50)
            DECLARE @MailSubject AS VARCHAR(100)
            
            SET @MailTo =  rtrim(@Administrator)
            
            @MailSubject = 'Your Summary Information'
                        
            SET @MailBody = 'Summary informaion for date:'
                  + CONVERT(CHAR(10),GETDATE(),111) + CHAR(10) + CHAR(10)
                  + ' can be found at the following link.'
            
            SET @MailBody = @MailBody + CHAR(10) + CHAR(10)
            SET @MailBody = @MailBody + CHAR(10) + @ApplicationRoot + 'Reports/SummaryInfo.aspx?ReportDate='
                  + CONVERT(CHAR(10),GETDATE(),111)

            EXECUTE master..xp_sendmail
            @recipients = @MailTo,
            @message = @MailBody ,
            @subject =@MailSubject

GO
0
 
crescendoCommented:
I use BLAT to send emails. It's a command-line programme and just needs an executable to be put on the server. As such, it's easy to call within SQL Server.

http://sourceforge.net/projects/blat
0
 
SoftEng007Commented:
if you're interested in SMTP mail check this url:

http://sqldev.net/xp/xpsmtp.htm

no exe's just a valid smtp mail server that allows forwarding.

0
 
crescendoCommented:
<<no exe's just a valid smtp mail server that allows forwarding.>>

but several dll's.  ;-)
0
 
yogic_flyerAuthor Commented:
Hmm...I was hoping I could salvage sendmail, but looks like it's more restrictive than I thought.
Anyway, I'll look into the alternatives...points split for you 3, hopefully that sounds fair.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now