Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ravibisht24
Starting Member
3 Posts |
Posted - 2012-11-01 : 05:02:52
|
| I have a process which sends mail with attachment (.csv file) through SP sp_send_dbmail. This SP sends mail successfully to user. User can open .csv file in windows. But same file can not open in I-Pad, iphone etc. Quick Look shows error.Your early response is highly appreciated.Below is the code which I am using to send mail.---================EXEC msdb.dbo.sp_send_dbmail@profile_name = 'AutoMail',@recipients = 'ravinder.singh@abc.com;',@copy_recipients = '' ,@blind_copy_recipients = '',@subject = 'Test mail',@body = 'The attach file contains a lis of agencies', @body_format = 'HTML', @execute_query_database = 'AU_08102012', @query = 'SET NOCOUNT ON;Select Convert(Varchar(10),AgencyID)AgencyID,Convert(Varchar(200),AgencyName) AgencyName From [AU_08102012].[Dbo].Tbl_Agency Where AgencyID < 20', @attach_query_result_as_file = 1 , @query_attachment_filename = 'NewMyTestFile.csv' , @query_result_header = 1, @query_result_width = 32767, @exclude_query_output = 1, @query_result_no_padding = 1, --@query_no_truncate = 1, @query_result_separator = ','--@ansi_attachment = 1--================R S Bisht |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-11-01 : 06:42:43
|
| My first suggestion is that the email is formatted with Windows line endings (CR+LF) and iOS probably uses Unix/Mac line endings (LF). I don't believe you can reformat it via sp_send_dbmail, and doubt that it's worth the effort if you can.To be honest, the failure is on the iPhone side, that software should be able to handle the line endings, if that is indeed the problem. |
 |
|
|
ravibisht24
Starting Member
3 Posts |
Posted - 2012-11-01 : 08:45:33
|
| Hi robvolk,Thnx for instant reply.The problem could be either side. If I send the same attachment through gmail to I-phone,Ipad etc then it is opening properly. But If I send the same through sp_send_dbmail or outlook express to I-phone,Ipad then it is not opening. R S Bisht |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-11-01 : 09:30:20
|
| Gmail is Unix based so it will send using LF line endings. You'd have to perform some kind of line ending translation on the message. Probably the easiest way to do that is set up a Unix/Linux email server and use that server with Database Mail. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-11-01 : 10:14:21
|
| Also see this: http://support.apple.com/kb/PH3405Again, the problem is on the iOS side, it probably isn't worth lots of gyrations on the SQL Server side to make the attachments work directly. |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2012-11-01 : 11:10:12
|
| I wonder if this is going to show up in the next Samsung Galaxy vs. iPhone commercial."Did you just open a .CSV file from an Outlook email server? Why can't we do that?"CODO ERGO SUM |
 |
|
|
|
|
|
|
|