How do I avoid .bin attachments with SmtpClient.Send(MailMessage)?

I'm hitting the problem
described here. However, I don't see any way with MailMessage to set the ordering of the content of the email.
How can I fix this?
MailMessage mail = new MailMessage(new MailAddress(emailTempKeysFrom, "Windward Studios"), new MailAddress(to[0], pur.Account.Name));
mail.Body = txt;
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html);
int num = 0;
foreach (MemoryStream mem in imagesTempKeys)
mem.Position = 0;
LinkedResource res = new LinkedResource(mem);
res.ContentId = "image" + num;
res.TransferEncoding = TransferEncoding.Base64;
htmlView.LinkedResources.Add(res);
num++;
mail.AlternateViews.Add(htmlView);
mailObj.Send(mail);
thanks - dave
What we did for the last 6 months -
Made the world's coolest reporting & docgen system even more amazing

Hello,
Not sure if you have already seen this
ContentDisposition Class, with it, sending a CSV file by using stmpclient, I can received the file with the correct format in the Outlook:
static void Main(string[] args)
try
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential(usename,password);
client.EnableSsl = true;
client.Port = 587; // Gmail works on this port
client.Host = "smtp.gmail.com";
MailAddress from = new MailAddress(from)
// Set destinations for the e-mail message.
MailAddress to = new MailAddress(to);
// Specify the message content.
MailMessage message = new MailMessage(from, to);
message.Body = "This is a test e-mail message sent by an application. ";
// Include some non-ASCII characters in body and subject.
string someArrows = new string(new char[] { '\u2190', '\u2191', '\u2192', '\u2193' });
message.Body += Environment.NewLine + someArrows;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.Subject = "test message 1" + someArrows;
message.SubjectEncoding = System.Text.Encoding.UTF8;
string file = "Sample20150126.csv";
// Create the file attachment for this e-mail message.
Attachment data = new Attachment(file, MediaTypeNames.Application.Octet);
// Add time stamp information for the file.
ContentDisposition disposition = data.ContentDisposition;
disposition.CreationDate = System.IO.File.GetCreationTime(file);
disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
// Add the file attachment to this e-mail message.
message.Attachments.Add(data);
// Set the method that is called back when the send operation ends.
client.SendCompleted += new
SendCompletedEventHandler(SendCompletedCallback);
// The userState can be any object that allows your callback
// method to identify this send operation.
// For this example, the userToken is a string constant.
string userState = "test message1";
client.SendAsync(message, userState);
Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.");
string answer = Console.ReadLine();
// If the user canceled the send, and mail hasn't been sent yet,
// then cancel the pending operation.
if (answer.StartsWith("c") && mailSent == false)
client.SendAsyncCancel();
// Clean up.
message.Dispose();
Console.WriteLine("Goodbye.");
catch (Exception e)
Console.WriteLine(e);
private static void SendCompletedCallback(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
mailSent = true;
Console.WriteLine("Sent");
Please have a try and if this does not work, please feel free to let me know.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How do I avoid duplicates importing with dvd's?

    I just bought my Mac, and love it! I am learning as I go, and so far everything has been very straightforward. I previously had a home PC where I stored all of my photos using Picasa. Short story, all became scrambled (1.000's of pics), and was totally unable to fix it. I do have dvd's with the correct content that I would like to import, but several have duplicate photos. Every time I try, I see duplicates in my library. This would amount to 100's of duplicates. Is there a shortcut? I see that "avoid duplicates" is an option with cameras and other devices, but cannot figure out how this works with DVD's. I am very frustrated, and have spent hours and hours trying to get it right. Could anyone please give me some advice? I would be so appreciative!!! Thank You!!!

    Purchase and run Duplicate Annihilator - http://brattoo.com/propaganda/ - on your iPhoto library
    LN

  • How to use /usr/bin/gcc  with Accelerate?

    Hi,
    After upgrading Mac to OSX10.9, C compiler has been changed to LLVM.
    Using gcc4.9(http://hpc.sourceforge.net), /usr/local/bin/gcc -framework Accelerate xxx.c works well.
    Using /usr/bin/gcc, how to compile it with Accelerate?

    Put the line, #include <Accelerate/Accelerate.h>, in your program,
    cc -framework Accelerate xxx.c

  • How do I avoid sizing issues with a Bevel?

    I am designing a logo for a startup business, and a beveled filter really looks nice for this particular company. The client really likes what I came up with. The problem is the filter seems to cause sizing issues. Enlarging it is creating ugly pixelation. Is there a method for avoiding this, or can I simply not use a bevel?
    Thanks.

    In the preferences check scale strokes and effects

  • How to install rpm.bin file with rpm

    Have downloaded Java...rpm.bin for Linux. rpm doesn't recognize bin file. Can't find doc to explain what utility converts rpm.bin to simple rpm. What do I use? Thanks.

    It took me some time to figure it out,
    once you downloaded the j2sdk...rpm.bin file, it is a self installation file,
    1) make sure the file is executable
    #chmod 755 j2sdk1.4.0_01.rpm.bin
    2) execute the file
    #./j2sdk1.4.0_01.rpm.bin
    this will install the package and inflate the rpm...
    good luck.

  • How to read the mails attachments with abap?

    HI All,
    I am looking for some way to read mails in the workplace inbox and to get their attachments.
    I will appreciate any help .
    Regards,
    Ari

    Does [this |http://help.sap.com/saphelp_nw04/helpdata/en/a7/3b2a2d45a34a23b75e3b18745c63bc/frameset.htm]help?
    Using the GET_ATTACHMENTS() attachment protocol method, get the attachment table. When reading the attachments, ensure that you use the GET_KIND() method to check the attachment object type before you access the data.

  • How do I downlaod Gmail attachments with FDM?

    1. FDM downloads even if plug-in is disabled. I do not see a way to use the browser's downloader rather than FDM.
    2. When downloading a Gmail attachment a "service login" is downloaded and not the doc.
    I am not sure why this is happening - at some point it was not and then it was again and then it wasn't - now it is again happening.
    I am using the latest update.

    Hi guigs2,
    The link you provided is for attaching files to gmail.
    1. I do not have pop-up blocker activated, so I cannot add gmail as an a exception.
    2. My problem is not about adding attachments, but about downloading them.

  • How do I avoid synching Outlook with iCloud?

    I am about to move to iCloud.  My company email, calendar and notes are in Outlook 7.  My IT advisor said don't allow the Cloud access to Outlook.  I am avoiding installing iCloud on my iPhone 3GS and iPad 2 because it'll affect the Outlook program.  Any advice here? 

    it won't affect the computer if you don't have iCloud control panel installed on the computer or if your not signed in iCloud control panel.
    even if you install icloud (iOS 5) on any of the devices, you'll have the option to turn it on or off

  • How do I avoid duplicate files with a copy response

    I have to copy or export mov files to a folder in a Windows network.
    To automate this I've set up a copy response and a response to change the asset status to 'Finished'. A subsription is holding two responses: the copy response to the Windows network (triggered by the change of the asset status to 'Create Deliverables') and the change-asset-status response (to 'finished').
    'Create Asset' is NOT on and I had to tick 'Run in parallel' otherwise it would create many duplicates.
    Still I'm getting sometimes 2, sometimes 3 copies of the same file.
    Any idea why? And - more important - what to do to avoid this?
    Thanks, Henk

    The problem: your subscription is trigger 2 or 3 times creating more than one copy of the file
    What's causing the problem: there is a bug (already report to apple and to this forum) in the "Set asset metadata" response wich is triggering the subscription several times.
    If you don't believe me try removing the "set asset metadata" response from the subscription and everything will work just fine.
    Because of the way your subscription is built I don't see any way to fix this. All you can do is to set the copy response to "Overwrite" so you'll only have 1 copy of the file in the destination folder.
    If any one want some more info about this bug just ask me or go to
    http://discussions.apple.com/thread.jspa?messageID=9324469&#9324469
    Best regards

  • Assessment cycle  - how do retain a certain amount with the sender and allocate the balance

    Hello,
    This is the scenario
    We currently use an assessment cycle to allocate some administrative costs from an admin cost center  to a few select cost centers.
    Let's say admin cost center is X
    Total plan cost for a period for X is $100
    Total plan allocation is 70% of $100.
    $30 of plan value will remain in the cost center X as a non-allocable plan cost
    Let's say actuals for X for a period is $120
    I would want to retain exactly $30 as the non-allocable value with X and allocate everything else that was actually posted.
    So I want to allocate only $90 to other cost centers.
    How can i set up this logic in an assessment cycle?

    Hi
    I see two possible ways
    1. Custom program using standard BAPI
    2. Use SKF, where
    Sender = CC X
    Receiver = CC X, Y and Z
    Receiver tracing factor - SKF
    Skf qty will be 30 for X, 40 for Y and rest for Z. Skf qty of 30 for X will remain same every month
    Br. Ajay M

  • I download apps directly to my iphone.  When I sync with my laptop, how do I avoid having sync delete apps, photos, songs downloaded on my iphone?

    I download apps directly to my iphone.  When I sync with my laptop, how do I avoid having sync delete apps, photos/vdeos, songs downloaded on my iphone?

    If you are syncing to the same computer that you always sync to, and have each of the items in itunes that you want synced then you shouldnt have an issue. The only way you would have an app come off your phone is if you uncheck that app from syncing in th apps location in itunes.

  • How do I save attachments with an E Mail?

    How do I save attachments with an E Mail?

    Hover the mouse at the top of an email with an attachment, in the area shown in the image below, and it should reveal the attachments icon - select it and download the attachments to wherever you wish on your HD.

  • How do I convert .MSG files with their attachments to a .PDF?

    These files were profiled in Hummingbird, then exported to Workshare, but it is not bringing the attachments with it. I work for a litigation firm that is needing 300 separate MS Outlook emails converted to a .PDF to bates label.

    Hi integrity development,
    To convert a photo on your iPhone to PDF, do the following:
    Open the free Reader mobile app (if you don't have it, you can download it from the App store).
    Tap the menu in the upper-left corner (the three horizontal red lines).
    Tap Camera to PDF.
    Tap either Take Photo or Select Photo.
    Select your photo and tap Use.
    Please let us know how it goes.
    Best,
    Sara

  • Every time I sync my iCal computer with my iPhone 4 or iPad, duplicate entries are generated on both systems. What am I doing wrong or how can I avoid the duplications?

    Every time I sync my iCal on my computer through iTunes with my iPhone 4 or iPad, duplicate entries are generated on both systems. What am I doing wrong or how can I avoid the duplications? I have been doing this for several years and this problem is a more recent issue, like in the last 6 months. I have been deleting the duplicate entries, on both systems, but some duplicates reappear through "general" entries that are connected to the correct color for a Calendar, but not the name. I am going nuts and wasting tons of hours trying to get the 3 calendars to sync without generating duplicate entries.

    Choose one of the Calenders on ONE of the computers OR the MobileMe as the Master / correct account.
    The REINITAILISE the data of MobileMe within preferences on the computer defining the datatransfer correctly (in the advanced box of preferences). The synchronise iphone contacts and calender directly on-line to MobileMe.
    I posted a question on this today, and gave my own reply !
    Regards,
    Kevin

  • How to send smartforms as pdf attachments with e mail

    hi experts,
    how to send smartforms as pdf attachments with e mail???
    nitin

    Hi
    In the FORM Interface put proper parameter. Hope this helps.

Maybe you are looking for

  • Ipod on my tv

    I have an Ipod classic 80gb about a year ago I bought an A/V composite cable and it worked great until a month or so ago now I can only get audio and not video I don't want to by another one since it's 50 bucks and I ain't got dime to my name what a

  • ABAP Mapping doubt

    Hi. I'm trying to do an abap mapping. I've read weblogs from Robert Eijpe. The samples contained in the weblog worked fine but i have a doubt. ABAP class had a parameter called SOURCE. This parameter contains the XML but i think is contained in only

  • Is there any way I can rotate pdf's in Adobe Reader?

    I want to use Adobe Reader to view drawings when out on site, but they often open in portrait when they should be landscape.  Is there any way I can rotate the view?

  • ITunes reports the following on startup: "iTunes was not properly..."

    All of a sudden whenever I start iTunes it gives me an error message telling me that "iTunes was not properly installed. If you wish to import or burn CDs, you need to reinstall iTunes". I've read and did everything that other threads like this have

  • ICloud not syncing all purchased songs

    I currently have three devices associated with my Apple ID: a Windows Vista desktop, a Windows 7 laptop, and an iPod 2 with iOS 5 on it. On each of these, iTunes is the most recent version. In each, I'm able to sync MOST of my purchased music from th