.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Email Attachment Problem

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
hi everyone,I am having a chart, and want to be able to click the "send it by email" and then popup an email window with the chart on the attachment.However, the attachment does not show.here is my code: string ServerPath = Protocol + Request.ServerVariables["SERVER_NAME"] + Port + Request.ApplicationPath + @"/graphs/" + User.Identity.Name + graphID + ".jpg"; string mailToString = "mailto:?subject=Trade Graph&Body=See attachment for the charts, or please click: " + ServerPath + "&Attachment="+ServerPath; string popupScript = "<script language='javascript'>" + "window.open('" + mailToString + "', 'CustomPopUp', " + "'width=200, height=200, menubar=yes, resizable=no')" + "</script>"; Page.ClientScript.RegisterStartupScript(typeof(Page), "PopupScript", popupScript); thank you guys!

View Complete Post

More Related Resource Links

Sharepoint 2007 Email problem


I've used Sharepoint 2007 to create my website. Within my web pages I've included Forms in order to capture people's contact details, so that when they 'Submit' the form their details are emailed to my email account. The problem is that when I go to Form Properties and insert the email address to which I want the data sent, I receive this message: "This form cannot be configured to send results via email. The web site may be based at a disk-based location, or a location that has not been configured to send email. Contact your system admin or ISP for more info. Would you like to remove the email recipient Yes or No"   

I am satisfied that the settings within the webhosting service are correct. Is this functionality available with Sharepoint 2007 or do I need to switch to alternative software.



Dialog attachment scrolling problem

When opening an item from a list in a dialog and then attaching a file we have noticed that the vertical scroll bar disappears from the dialog. You can still navigate the form using the Tab key, but is there a way to restore the scroll bar or is there a Hotfix we can get to do repair this issue? Thanks.

email subscription problem

Hello All Experts, I have created email subscription for one report, which is working properly. I have scheduled it on everyday,its automatically send emails to the concern email id on everyday basis. Now is there any way suppose when reports get executed and reports comes blank then its shouldnt send mail on that day. Is it possible or not? Because currently the report is coming blank then also its sending blank report to the concern email id. Please guide me. Regards,AKM  

how to send email in asp.net with attachment c# code

 SmtpClient smtpClient = new SmtpClient();         MailMessage message = new MailMessage();         try         {             MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text);             // You can specify the host name or ipaddress of your server             // Default in IIS will be localhost              smtpClient.Host = "localhost";             //Default port will be 25             smtpClient.Port = 25;             //From address will be given as a MailAddress Object             message.From = fromAddress;             // To address collection of MailAddress             message.To.Add("admin1@yoursite.com");             message.Subject = "Feedback";             // CC and BCC optional             // MailAddressCollection class is used to send the email to various users   

SSIS 2005 - Send Mail Task - signature appended to email is garbled - unicode problem?

Hi, I'm pretty new to SSIS so go easy on me. I have a Send Mail Task to notify if a file cannot be imported - the mailbody is created on the previous step by a VB.NET script task to include the name of the file and the path it's been archived to. The problem I'm having is that while the body of the email I've created is displaying fine, our company's Exchange server appends a signature to all emails, and this is coming up as undisplayable characters, presumably due to some kind of unicode encoding problem. I've tried casting the email body in an expression to DT_STR (doesn't work as DT_STR "cannot be converted to a supported type" which seems a bit odd but never mind), DT_WSTR (garbled signature), DT_TEXT/DT_NTEXT (strange error on this one - "Attempted to read or write protected memory") none of those ideas worked, and I'm a bit stumped now. Can anyone help? I'm using SSIS 2005 with SP3

Email - From Address Problem

Hello All,I have a sample Email code - MailMessage Message = new MailMessage(); Message.IsBodyHtml = true; Message.To.Add(new MailAddress("TO@gmail.com","ToName")); Message.From = new MailAddress("FROM@abc.com","FromName"); Message.Subject = "Test Sub"; Message.Body = "This is Test!!!"; SmtpClient sc = new SmtpClient(); sc.UseDefaultCredentials = false; sc.Host = "smtp.gmail.com"; sc.Port = 587; sc.Credentials = new NetworkCredential("CREDENTIALS@gmail.com", "CredentialsPassword"); sc.EnableSsl = true; sc.Send(Message); When i Use this code - Email is going 100% successfully but, Insted of displaying from address as "FROM@abc.com" - it is displaying it as "CREDENTIALS@gmail.com".** From Name is displaying correctly.So the email in email Client is pretty confusing with this problem. Kindly suggest me some work arounds.FROM@abc.com

EWS save email attachment (ItemAttachment)

Hello, I'm using Exchange Webservices. I try to save an email attachment which is a email itself. It is not a FileAttachment, but an ItemAttachment. We are running Exchange 2007. I use .NET c# foreach (Attachment att in mail.Attachments) { // Save normal files to disk<br/> if (att is FileAttachment) { FileAttachment fa = (FileAttachment)att; String s = @"..\attachment\" + att.Name; fa.Load(s); } <br/> // Save attached EMails to disk<br/> if (att is ItemAttachment) { what to do here?<br/>  }   Any ideas? I tried to cast Item Attachment to Fileattachment, but it does not work. Thank you very much! Best regards!

Email Problem with Exchange 2010

Good day,   I recently upgraded a server of mine with a simple ASP site to server 2008 and it sent emails from exchange 2003 with no problems after the upgrade to server 2008.  Here is the code: private void SendTextMessageCC(string fromAddress, string fromName, string toAddress, string subject, string body, string ccAddress) { try { MailAddress fromAdd = new MailAddress(fromAddress, fromName); MailAddress toAdd = new MailAddress(toAddress); MailAddress ccAdd = new MailAddress(ccAddress); MailMessage msg = new MailMessage(fromAdd, toAdd); msg.Subject = subject; msg.Body = body; msg.CC.Add(ccAdd); SmtpClient client = new SmtpClient("deexch1.****.com"); // localhost client.Send(msg); // msg.DeliveryNotificationOptions = 0; // 2 means OnFailure was 1 but that was error 0 okay means "None" } catch (SmtpException s) { lblSuccess.Text = s.Message; } } Now this week I upgraded my Exchange Server to 2010 and changed the smtpclient string accordingly above to SmtpClient("draw-mail1.****.com"). It will not send emails from the se

How do you extract data from the xml attachment of an incoming email and set it as metadata in a doc

Hi, I currently have a document library that contains InfoPath forms. As a form is loaded into the document library I need the data to be extracted from the infopath file and then set as properties/metadata of the file. The infopath forms will be sent to the SharePoint site as an email attachment. So basically, an email is sent to the SharePoint server with an InfoPath form as an email attachment. The InfoPath form needs to be extracted from the email and uploaded to the document library and at the same time updating the document library metadata with the infopath form data. This has been done using Visual Studio but can this be done using SharePoint Designer 2010 now that we have upgraded our site to SharePoint 2010? Any guidance will be greatly appreciated! Thanks Michael

Problem sending an email to all users of a sharepoint group

Here is what we did so far: 1. created an OU in AD and delegated full control to Sp service account 2. Configured incoming email settings 3. on sp site created a new group with full control permission 4. created an email distribution group for this group with an email address 5. in CA approved the distribution group to be created in OU 6. In Ad we can check the OU is there with the specified email address 7. added users to the group, but when we send an email to the group email address it does not forward to the group members. Please advice  

attachment in email

hi i have a page for getting the information from students about their academics.i am sending this detail to client email id on the click of sbmt.i do have a file uploader in that page for uploading resume.hw can i send this resume to clietn email as an attachment as word file. 

EMail Validation Problem

Hai friends,         I have to do  validation for E-Mail using JAVA Script,  The Following code was not working, function Valid() { if (ValidateEmail("<%= textBox.ClientID %>") ) { alert ("Correct"); return true ; } else { alert ("Not Correct"); } } function ValidateEmail(email) { var EmaiAddress=document.getElementById(email); var RegExEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/; if(!RegExEmail .test (EmaiAddress )) { return false ; } else { return true ; } } <asp:button id="button" runat="server" OnClientClieck="validateEmail() " >but,This code was working, function ValidateEmail() { var EmaiAddress=document.getElementById("textbox").value; var RegExEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/; if(!RegExEmail .test (EmaiAddress )) { alert("Not Correct"); } else { alert("Not Correct"); } } <asp:button id="button" runat="server" OnClientClieck="validateEmail() " >   Please Fix the solution.  

How To Save Pdf File In Client's Computer For Sending As Email Attachment


Hello everybody.

The subject of this thread is my question and I am really very sorry, I cannot brief it. I have generated the pdf file which contains text taken as input by various web-form and have saved it in my local drive then sended it to some email addresses. Now I want to know that how can I save it in client computer and send it to some email addresses provided by Client on demand?

I am failed to solve this problem as I don't know how to get INFORMATION OF CLIENT'S LOCAL DRIVE AS CLIENT MAY USES DIFFERENT OPERATING SYSTEM.

Any information will be very helpful to me.

Thank you.

SharePoint 2010 Incoming Email cannot process email file attachment in email with less than sign < a


When sending an email which contains an email attachment such as "Hello <World>.msg" from Outlook to SharePoint 2010 email enabled list such as an "Announcements" list, no item is created in the list and the attached email and the orginal email are not saved.

The log file contains

09/23/2010 13:51:17.54  OWSTIMER.EXE (0x18FC)                    0x0B2C SharePoint Foundation          E-Mail                         6873 Warning  An error occurred while processing the incoming e-mail file C:\inetpub\mailroot\Drop\f17ce37101cb5b600000002a.eml. The error was: Illegal characters in path.. 9f265722-74c9-4bd8-9504-ac265f2351d7

SharePoint 2010 Incoming Email cannot process file attachment with zero size.


When sending email with attachments to SharePoint list, if one of the file attached to the email is of size 0, then none of the files will be saved and NO new item will be created in the list.

The SPEmailHandler's ProcessAttachment method should check the length of the "contentStream". If the length is 0, it should return immediately.

As you can see in the ProcessAttachment method none of the arguments are validated before they are used. This an example of poor quality code.

It should do at least

if (contentStream == null || contentStream.Length == 0) return;

if (string.IsNullOrEmpty(fileName) || item == null) return;


private static void ProcessAttachment(Stream contentStream, 

memorystream attachment on an email



Sorry if this is the wrong forum, couldn't find a mail or IO forum. I'm trying to attach a memorystream as an attachment to an email, however the file is always empty. I'm using a streamwriter to write the text in to the memorystream, I then flush the streamwriter and I can see the memorystream has data. However when I attach the memorystream to the email the file is always empty. I can't see what I'm doing wrong. Any help would be great. The code is:

                    System.IO.MemoryStream memorystream = new System.IO.MemoryStream();
                    System.IO.StreamWriter streamwriter = new System.IO.StreamWriter(memorystream);
                    Attachment data = new Attachment(memorystream, fName, MediaTypeNames.Application.Octet);
                    SmtpClient smtp = new SmtpClient();

var4 is a string of XML data.






How to generate an excel and send it as email attachment in SSIS 2005 Script Task Component?


I am using a "Script Task" component. I am trying with following three simple steps:

1) Obtain the excel content in HTML

Dim reportInHtml As String = GenerateHTMLReport()

2) Generate an excel with below code:

Dim message As MailMessage

message = New MailMessage(fromAddress, toAddress, subject, String.Empty)

Using memoryStream As MemoryStream = New MemoryStream()

        Dim contentAsBytes As Byte() = Encoding.UTF8.GetBytes(reportInHtml)
        memoryStream.Write(contentAsBytes, 0, contentAsBytes.Length)
        memoryStream.Seek(0, SeekOrigin.Begin)

        Dim contentType As ContentType = New ContentType()
        contentType.MediaType = "application/ms-excel"
        contentType.Name = "Excel_Report.xls"

        Dim excelAttachment
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend