November 18, 2010 at 7:48 pm
Jeff Moden (11/4/2010)
I have to ask because I just don't know... Hopefully, one of you do. Is CDONTS and sp_OA* available in SQL Server Express?
Anyone?
--Jeff Moden
Change is inevitable... Change for the better is not.
November 19, 2010 at 1:02 am
Thank you for answer.
I change path and permissions with a share folder with permission to everyone.
But no change : mail is sending, we receive it well but without attach file.
Other idea ?
November 19, 2010 at 3:32 am
It was changed to a shared path - do you mean a UNC path? Is the path to the file something like this: \\server\folder? If so, then try mapping that to a local drive and try it again.
November 19, 2010 at 4:13 am
Yes, UNC path. I tried on the server and on my computer. And I tried server/computer name and with IP adress.
Same problem : mail is sending but without attach file
And there isn't any error message and I've no idea how debug this process...
November 19, 2010 at 4:47 am
And you verified the NTFS permissions?
November 19, 2010 at 5:41 am
yes i did;
control total to everyone
November 19, 2010 at 7:09 am
Jeff Moden (11/18/2010)
Jeff Moden (11/4/2010)
I have to ask because I just don't know... Hopefully, one of you do. Is CDONTS and sp_OA* available in SQL Server Express?Anyone?
I'm not certain, but I don't think CDONTS will be available. Don't think it'd be part of the install of SQL Server Express, but it *might* be part of the OS install, or might come with Microsoft Office if you've got the right parts installed. You're more likely to have CDOSYS I think, if it's newer version of Windows. In googling a bit it looks like maybe SQL Server Express does have email stuff on the SQL Server side, but the core email components (DLLs) are not included and emailing-related services are disabled and buried.
Sorry for the waffly answer. 🙂
November 19, 2010 at 7:34 am
dmbaker (11/19/2010)
Jeff Moden (11/18/2010)
Jeff Moden (11/4/2010)
I have to ask because I just don't know... Hopefully, one of you do. Is CDONTS and sp_OA* available in SQL Server Express?Anyone?
I'm not certain, but I don't think CDONTS will be available. Don't think it'd be part of the install of SQL Server Express, but it *might* be part of the OS install, or might come with Microsoft Office if you've got the right parts installed. You're more likely to have CDOSYS I think, if it's newer version of Windows. In googling a bit it looks like maybe SQL Server Express does have email stuff on the SQL Server side, but the core email components (DLLs) are not included and emailing-related services are disabled and buried.
Sorry for the waffly answer. 🙂
I am running 2008 developer, 2005 standard and Express and yes Express comes with the sp_OA just like SQL Server 2008 developer but no CDONTS. The reason those are COM dll which the developer division have depreciated since 2005 version of .NET.
Kind regards,
Gift Peddie
November 19, 2010 at 8:21 am
clement.degroote (11/19/2010)
yes i did;control total to everyone
If permissions is not the issue it may related to the attachement definition in the code. There are two ways to send attachments with System.net.mail one is to use filesystem or to use the streams both require System.IO Import or Using statement.
Kind regards,
Gift Peddie
November 22, 2010 at 7:45 am
Hello.
Sorry, but I don't understand. Could you tell me more ?
November 22, 2010 at 8:02 am
clement.degroote (11/22/2010)
Hello.Sorry, but I don't understand. Could you tell me more ?
Sure so instead of
Imports System.Net
Imports System.Net.Mail
use the code below instead
Imports System.Net
Imports System.Net.Mail
Imports System.IO
The later code lets you access the file system or the streams like memory stream which is one of the child classes of the Base Class TextWriter.
Kind regards,
Gift Peddie
November 23, 2010 at 10:51 am
we find issue to our problem. we add content-disposition option on the attachment file property.
See the code below :
If Not strAttachments.Equals(String.Empty) Then
Dim strFile As String
Dim strAttach() As String = strAttachments.Split(";")
For Each strFile In strAttach
Dim Data As Net.Mail.Attachment = New Net.Mail.Attachment(strfile.trim())
Dim Disposition As Net.Mime.ContentDisposition = Data.ContentDisposition
Disposition.CreationDate = System.IO.File.GetCreationTime(strfile.trim())
Disposition.ModificationDate = System.IO.File.GetLastWriteTime(strfile.trim())
Disposition.ReadDate = System.IO.File.GetLastAccessTime(strfile.trim())
Mailmsg.Attachments.Add(Data)
Next
End If
It works well; so thanks a lot to everyone for help.
Very good article and very useful for us.
king regards
December 20, 2010 at 2:08 am
I've tried the mail send as described here. Its working great except for the part where line breaks/carriage returns are removed from the body of the message. The way I've tried it so far is the p_SendEmail procedure is called via my procedure where the body of the message is concatenated(formatted with line breaks). The mail and attachments are recieved but the line breaks generated by my procedure gets removed.
This is how I have generated the linebreaks
SET @MSG ='Dear All,'
SET @MSG=@MSG+CHAR(13)+'Executive : ' +@EXECUTIVE
SET @MSG=@MSG+CHAR(13)
SET @MSG=@MSG+CHAR(13)+'Start Date : ' +CONVERT(VARCHAR(20),@START_DATE,106)
SET @MSG=@MSG+CHAR(13)
SET @MSG=@MSG+CHAR(13)+'End Date : ' +CONVERT(VARCHAR(20),@END_DATE,106)
Finally I pass @MSG as the body of the mail. When the mail is received all the line breaks/carriage returns are absent. Any idea on what's going wrong? The line breaks work properly when I use SQL Db mail.
--Replaced CHAR(13) with < /br>. Works fine
February 9, 2011 at 10:28 pm
Any tips on how to make this work with an Open SMTP Server?
February 20, 2012 at 12:17 pm
Do you think would be an answer for the problem (in sql 2008) where, using database mail to send email and attachments when logged on to sql with sql authentication, won't allow sending the attachment unless one has sysadmin permission?
Here is the books online discussion:
Database Mail uses the Microsoft Windows security context of the current user to control access to files. Therefore, users who are authenticated with SQL Server Authentication cannot attach files using @file_attachments. Windows does not allow SQL Server to provide credentials from a remote computer to another remote computer. Therefore, Database Mail may not be able to attach files from a network share in cases where the command is run from a computer other than the computer that SQL Server runs on.
Have been googling this for days. No one seems to have solution for this problem other than to use windows authentication or give user greater permission, neither of which, is desirable. thanks for any thoughts on this.
Viewing 15 posts - 31 through 45 (of 54 total)
You must be logged in to reply to this topic. Login to reply