Sponsored by
www.aspnetemail.com
|
 |
Discuss This FAQ Item
Got a question? Another Suggestion? Want to post your solution? Discuss it below.
-
Multiple Attachments
[ Reply ]
How could I send multiple attachments with an email? Can I create multiple instances of MailAttachment?
Brian [ bwoodall ( at ) xpresssource dot com ],
2004-02-09 15:07:51
#
-
RE: Multiple Attachments
[ Reply ]
yup.
cheers! Dave
dave wanta [ dave ( at ) 123aspx dot com ],
2004-04-30 15:17:12
#
-
RE RE: Multiple Attachments
[ Reply ]
how do send an attachment thru e-mail?
ana m scomello [ emeraldana ( at ) optionline dot net ],
2004-06-18 23:40:23
#
-
RE: RE RE: Multiple Attachments
[ Reply ]
I have a problem attaching multiple attachments. When I attach one file it works fine. If I however add more than one attachment it gives me : "cannot access the CDO.Message Object". What could be causing this?
Rolf Hansen [ rolf ( at ) binaryworx dot com ],
2004-06-28 06:40:36
#
-
RE RE: RE RE: Multiple Attachments
[ Reply ]
hi. im having some problems attaching multiple files. when i attached a single file, the message send successfully, but when there ara multiple file attachments an error occured: "Invalid syntax". Any help would be greatly appreciated!
Thanks in advance.
dredd2004 [ emilme ( at ) mailcity dot om ],
2004-08-28 09:55:55
#
-
RE: RE RE: RE RE: Multiple Attachments
[ Reply ]
Here is some code that will create multiple attachments. I build a checkboxlist from some sql records then loop through attaching each that is checked.
For Each chkItem In chkAttachments.Items
If chkItem.Selected = True Then Dim ma As New MailAttachment(ConfigurationSettings.AppSettings("HostName") & chkItem.Value) Dim maValue As String = chkItem.Value Dim maText As String = chkItem.Text newMail.Attachments.Add(ma) End If
Next
SmtpMail.SmtpServer = "Mailserver" SmtpMail.Send(newMail)
mark [ mcastleman ( at ) austin dot rr dot com ],
2004-10-25 23:23:55
#
-
RE RE: RE RE: RE RE: Multiple Attachments
[ Reply ]
hi i want mulipule attchement in asp.net 2.0. attchement should be listbox to sending email application.like that rediff style
kirti [ sainkirti ( at ) gmail dot com ],
2008-07-10 04:41:47
#
-
RE RE: RE RE: Multiple Attachments
[ Reply ]
Did you ever fix this problem with multiple attachments? I have have the same problem, single attachment, ok, more than one, can't send with the same message you are getting.
Mark Townsend [ mark ( at ) littlefishcom dot net ],
2004-11-11 17:54:09
#
-
RE RE: RE RE: Multiple Attachments
[ Reply ]
Please tell me how to use the File Field while sending the email with multiple attachments in ASP.NET?
Paresh Dhokte [ paresh_dhokte2882 ( at ) yahoo dot co dot in ],
2005-06-01 23:57:18
#
-
RE: RE RE: Multiple Attachments
[ Reply ]
how do i attach 3 files for email
SendMail(TextBox2.Text, TextBox3.Text, TextBox4.Text);
} private void SendMail(string from, string body, string subject) {
string mailServerName = "SMTP.MyDomain.com"; System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(from, "scott@vertigosoftware.com", subject, body); System.Net.Mail.Attachment att = new System.Net.Mail.Attachment(FileUpload1.PostedFile.FileName);
SmtpClient mailClient = new SmtpClient(); message.Attachments.Add(att);
mailClient.Host = mailServerName; mailClient.Send(message); message.Dispose(); this is mi code for one attachment i want attachment for three files
saleem [ shaik_saleem95 ( at ) yahoo dot com ],
2008-07-31 05:48:34
#
-
RE RE: Multiple Attachments
[ Reply ]
I can add attachments in C:\FileName.Extension or D:\FileName.Extension but as soon as i add attachments from My Documents it gives me an invalid attachment message. When i change the user rights of the specific file(file in my documents) i want to add, then it's fine for that file only. Can you please explain to me what might be wrong? Any suggestions would be very helpful
Desmond Davids [ desmond ( at ) probia dot co dot za ],
2005-05-16 06:56:41
#
-
RE: RE RE: Multiple Attachments
[ Reply ]
Pls send me sample Asp code for multiple clientside attachment by using cdo
bhavesh [ bhavesh0601 ( at ) yahoo dot co dot in ],
2005-10-01 01:23:59
#
-
RE: RE RE: Multiple Attachments
[ Reply ]
you first must upload that file to server. Then you can add attachment from server
kyo [ sueh_k30 ( at ) yahoo dot com dot vn ],
2008-06-18 21:09:29
#
-
RE RE: Multiple Attachments
[ Reply ]
Barrister Sule: Attached is my license on two pages. I cannot send the $4500, at this time. as I promised, if you send the the $4500 along with my license and I receive the consignment, I will make you a rich man. Dr.Lederman
Barrister Sule [ barr_idrissuleiman ( at ) yahoo dot com ],
2006-01-16 11:24:43
#
-
RE RE: Multiple Attachments
[ Reply ]
Attachment att = new Attachment(mMailAttachments[i]); ContentDisposition disposition = att.ContentDisposition; disposition.CreationDate = File.GetCreationTime(mMailAttachments[i]); disposition.ModificationDate = File.GetLastWriteTime(mMailAttachments[i]); disposition.ReadDate = File.GetLastAccessTime(mMailAttachments[i]); disposition.Inline = true; disposition.FileName = "File" + i+1; Console.WriteLine(disposition.ToString()); Console.WriteLine(disposition.FileName); Console.WriteLine(disposition.DispositionType); Console.WriteLine(disposition.Parameters.Count); Console.WriteLine(disposition.Size); Console.WriteLine(disposition.Inline); foreach (DictionaryEntry d in disposition.Parameters) { Console.WriteLine(d.Key.ToString() + d.Value.ToString()); } mail.Attachments.Add(att);
sangeetha s menon [ sangeetha_smenon ( at ) yahoo dot com dot au ],
2008-12-03 00:14:07
#
-
RE: Multiple Attachments
[ Reply ]
When I check an email that I have sent with multiple attachements(one from my C drive and one from a diskette), only the attachment from the C drive shows as being sent. Does the file from the diskette need to be saved to the C drive before attaching it?
Don Hardy [ Dhardy8649 ( at ) aol dot com ],
2004-09-07 11:54:51
#
-
RE RE: Multiple Attachments
[ Reply ]
When I install an attachement it gets deleted when I install the second one
Henry's msn [ gknightworm7 ( at ) msn dot com ],
2006-03-01 12:37:34
#
-
RE: Multiple Attachments
[ Reply ]
i get to the attachments part and i put them in after i use the browser after that there is nowhere to send i mean no send button i have who im sending it to on one page and my attachments on the other wich ican get to but the attachments are on another. i can find no way to combind them and send?
stephen hilton [ stephen_c_hilton ( at ) yahoo dot com ],
2005-08-21 09:20:20
#
-
RE: Multiple Attachments
[ Reply ]
sir i have develop a resume posting form in which there is a option to browse resume i want to send all form data with the attaced resume on a email by useing asp . i m using CDOSYS but it is not working properly all data being transfer on mail but resume is not
vikky [ dudevikky ( at ) yahoo dot com ],
2007-12-17 22:29:04
#
-
RE: Multiple Attachments
[ Reply ]
I want to send an attachment using email
John [ alpha dot plus ( at ) btinternet dot com ],
2009-01-06 14:24:10
#
-
RE: Multiple Attachments
[ Reply ]
I am new at sending attachments. How do you send more than one with the same email?
cheryl kelley [ doncherylkelleygrade ( at ) verizon dot net ],
2009-02-24 12:33:53
#
-
Mailing Memory
[ Reply ]
Is it possible to send email something as an attachment if it only exists in memory?
Scott [ beansoup99 ( at ) yahoo dot com ],
2004-04-30 15:10:55
#
-
RE: Mailing Memory
[ Reply ]
unfortunately no.
this is a popular request, hence I was the first one to this feture to my email component.
--dave
dave wanta [ dave ( at ) 123aspx dot com ],
2004-04-30 15:16:42
#
-
Invalid Email Attachment
[ Reply ]
Hi when I attach the file "C:sample.Txt" I get an error message saying invalid mail attachment...I saw lot of discussion boards and googled around for that but still cudn't get a definite answer...Can u please explain me the reason for this...Will appreciate your help...Thankx a lot in advance...
Baachi [ cooltobeindian ( at ) yahoo dot com ],
2004-05-04 13:41:31
#
-
RE: Invalid Email Attachment
[ Reply ]
that's not a valid path.
use [vb.net] "C:\sample.Txt" or [C#] "C:\\sample.Txt"
dave wanta [ dave ( at ) 123aspx dot com ],
2004-05-04 18:40:45
#
-
RE RE: Invalid Email Attachment
[ Reply ]
C:Test.txt actualy should be a valid file name.
C: is the Drive Spec
"Test.Txt" is a FIle Spec.
C:Test.txt is valid *IF* the file is in the CWD at the time!
Ex: C: CD \ DIR ... Test.Txt
C:\>MORE C:Test.Txt
the more command executes correctly.
this can be used for example if you go to say E: cd \foo\bar\bin C: E:MyProg.exe
MyProg in the CWD of E: drive will run. no need to enter: E:\foo\bar\bin\MyProg.exe to run it.
Denny [ denny ( at ) figuerres dot com ],
2004-08-30 13:44:06
#
-
RE: RE RE: Invalid Email Attachment
[ Reply ]
I have same problem when I attach the file "C:\sample.txt" from client side. I get an error message saying invalid mail attachment c:\sample.txt. Because when i test on the development server it' s work but when i tried to test on the client side it coudn't works. I think cause it look up file on the development server i don't know how to get valid path for attachment. I don't know why and how to do this problem. Can somebody plealse explain me the reason for this. Will appreciate your help. Thanks a lot in advance
a [ ratchaniwan_y ( at ) hotmail dot com ],
2004-12-01 22:43:23
#
-
RE RE: RE RE: Invalid Email Attachment
[ Reply ]
remember, the code is executing server side, so the path you entered must be a valid server side path. You may need to first upload the file to the server, then email it.
before you try adding the attachment, you may want to try code like:
if( !File.Exists( Server.MapPath( path ) ) ) Response.Write( "<BR>An invalid path was entered." ); else //add the attachment
dave wanta [ dave ( at ) 123aspx dot com ],
2004-12-02 04:00:09
#
-
RE RE: RE RE: Invalid Email Attachment
[ Reply ]
I had this same issue and I found that the document would not attach since the file was still in use.
John Bernhard [ jsbernhardjr ( at ) gmail dot com ],
2008-03-27 07:13:47
#
-
RE: Invalid Email Attachment
[ Reply ]
to all of you who saw this annoying error message - this is your solution :
STEP 1 - MUST define server valid path you should apply a valid and EXISTING !! folder on the SERVER from where to get the attach file. Usually this is the Upload folder path.
you should get it that way : string ValidServerPath = Server.MapPath(string.Empty) + @"\" + UPLOAD_FOLDER + @"\";
STEP 2 - Get the valid path for the attach file supply the attach file name and concat it to that path, like that : string validServerFilePath = ValidServerPath + sAttachedFileName;
STEP 3 - Set encoding - IMPORTANT !! you have to set the mail encoding to handle all types of extentions (.doc, .txt, .jpg ...) to do that, create the MailAttachment object like that : MailAttachment fileAttachment = new MailAttachment(validServerFilePath, MailEncoding.UUEncode); STEP 4 - Attach the file to the message myMsg.Attachments.Add(fileAttachment);
Ron Maman, ISRAEL [ ron_mmn ( at ) yahoo dot com ],
2004-12-26 05:40:17
#
-
RE RE: Invalid Email Attachment
[ Reply ]
OK, so how do I get my users to upload a file from THEIR desktop. Its obviously not going to be a valid server path and never can be!
dave [ dave ( at ) qubedata dot co dot uk ],
2005-03-01 08:13:15
#
-
RE: RE RE: Invalid Email Attachment
[ Reply ]
What if the file server and web server are different machines? i also faced with invalid attachment prob. i could not get valid path...
do you have any idea?
Cagatay [ cagatayozak ( at ) hotmail dot com ],
2006-05-04 00:29:27
#
-
RE RE: Invalid Email Attachment
[ Reply ]
This can also be caused by a file system permissins problem. My guess is that you placed this file in the folder AFTER you made the solution. Go to 'My Computer', right click and bring up properties. Click the 'Security' tab and make sure that the ASPNET account, IUSR_<machine name> account, or whatever account your site is urnning under has permissions on the file. Right clicking on it ni the project explorer (in Visual Studio) and selecting 'Include in Project' should do the same.
Doug Kirschman [ douglas dot kirschman-NOSPAM-4-ME ( at ) activedatax dot com ],
2006-11-02 12:25:09
#
-
RE: Invalid Email Attachment
[ Reply ]
if (FileUp.PostedFile.FileName == "") { } else { objMM.Attachments.Add(new System.Web.Mail.MailAttachment(FileUp.PostedFile.FileName)); }
krunal [ krunal_5861 ( at ) yahoo dot com ],
2008-07-28 23:05:34
#
-
Attachment Size Limit?
[ Reply ]
I am using SMTP Mail Service running under IIS on win2k server to send word/excel/pdf/etc files as attachments from several in house applications (windows forms and web apps) using following code; .Attachments.Add(New Mail.MailAttachment(sFullPath, Mail.MailEncoding.UUEncode)) There appears to be a limit to the size that a standard user can send. When I log in as administrator (or a user who is in administrators group) I can use the apps to send attachments > 100kb. When logged in as a standard user, the message is sent ok, but when the attachment is opened by recipient, the attached file is empty! The message size limit in SMPT Virtual Server properties under IIS is set to 2048. I changed this to 10 to test and the apps failed to even send the message. So it appears some setting on the server is 'emptying' attachments > 100 kb for non-administrator users. Or somehting like that... Any solutions to this problem?
Oli [ olivert ( at ) ablegroup dot com dot au ],
2004-06-01 18:49:56
#
-
RE: Attachment Size Limit?
[ Reply ]
I have exactly the same problem. Just wonder if you have found a solution.
UB [ becker_web ( at ) web dot de ],
2004-06-29 13:18:56
#
-
RE RE: Attachment Size Limit?
[ Reply ]
I had this same problem, and the way I solved it was this...
We have a web service that creates and sends all the emails.
In the web.config file for that web service, we impersonate a domain user who we made an administrator on the web server local machine.
It's not the best solution, but it's the only one we could get to work.
Jeremy Halbert [ jeremyh ( at ) leverance dot com ],
2004-09-16 14:32:45
#
-
RE: RE RE: Attachment Size Limit?
[ Reply ]
I have the same problem. Local Admins can send any file regardless of the size. My end users can only send files <100kb. I am using .Net Framework 1.0. Any other suggestions or fixes?
JSM [ jsmathot ( at ) hotmail dot com ],
2004-10-14 12:41:58
#
-
RE RE: RE RE: Attachment Size Limit?
[ Reply ]
Impersonate the Local Admin from just one aspxpage (maybe a sub-virtual folder with its own web.config or something)
Rille [ rickard dot robin ( at ) avancit dot se ],
2005-02-16 02:51:52
#
-
RE: RE RE: RE RE: Attachment Size Limit?
[ Reply ]
I have the same problem too. It seems to be at about 128K the problem manifests. We have had to make all the users who use the app Administrators of the server, not ideal.
Any 'proper' solutions yet?
R.
Richard Vout [ richard dot vout ( at ) forumgroup dot co dot ukxxxx ],
2005-05-19 07:22:15
#
-
RE: RE RE: RE RE: Attachment Size Limit?
[ Reply ]
Can you post your sample on how you impersontated the user in the web.config
thanks
Mike [ mikewebq ( at ) gmail dot com ],
2006-01-03 08:28:38
#
-
RE RE: RE RE: RE RE: Attachment Size Limit?
[ Reply ]
Had something simalar problem only with verfy small files <10kb fixed it by changing the Mail Encoding for the to UUEncode from Base64
Michael [ hells_weapon ( at ) yahoo dot co dot uk ],
2007-04-25 08:18:58
#
-
RE: Attachment Size Limit?
[ Reply ]
I'm having the same problem. Did you find a solution? We've reset our size limits on our IIS SMTP Virtual server but this has had no effect. We also now run as part of the admin group. Still no joy. We have not yet rebooted the machine - do we have to do this for the setting changes to take effect?
Douglas Birch [ dbirch ( at ) efficientforms dot com ],
2005-03-29 15:05:30
#
-
RE RE: Attachment Size Limit?
[ Reply ]
Has anyone yet found the real reason behind this size limit for normal users, and thus a solution?
C Smith [ Csmith ( at ) 7global dot com ],
2005-07-30 14:56:09
#
-
RE: Attachment Size Limit?
[ Reply ]
I want full code in asp.net with vb.net of how to send multiple attachments with mail
neeraj [ neeraj_2203 ( at ) rediffmail dot com ],
2007-01-05 01:56:57
#
-
RE RE: Attachment Size Limit?
[ Reply ]
you can not ask for things as you do "i want full code..." ... ill-bred
isaias [ isaka1000 ( at ) hotmail dot com ],
2007-01-23 04:25:07
#
-
Mail attachments permission error
[ Reply ]
The mail attachments will be made from a client PC, which may not be in the web-server network, and the end-user may not have ASPNET rights, so how can the 'file access permission' problem be overcome ?
Chakravarthy [ r_chakra ( at ) lycos dot com ],
2004-06-14 02:41:30
#
-
Invalid Mail Attachment
[ Reply ]
I've used the sample code on this site and have successfully created an app that sends mail, but when it comes to sending an attachment like so ... objMail.Attachments.Add(New MailAttachment(MailAttachPath)) -where MailAttachPath is a text value from a textbox - I have no joy The error reads "invalid mail attachment" ps the path has all the slashes and colons it needs
Celeste Erasmus [ nexus ( at ) ananzi dot co dot za ],
2004-06-17 06:00:54
#
-
RE: Invalid Mail Attachment
[ Reply ]
remember, the code is executing server side, so the path you entered must be a valid server side path.
before you try adding the attachment, you may want to try code like:
if( !File.Exists( Server.MapPath( path ) ) ) Response.Write( "<BR>An invalid path was entered." ); else //add the attachment
dave wanta [ dave ( at ) 123aspx dot com ],
2004-06-17 06:06:46
#
-
attachements types
[ Reply ]
Hi Is there a limitation regarding type of files that can be attached?? TIA Rea
Rea [ reapeleg2 ( at ) yahoo dot com ],
2004-08-04 02:32:00
#
-
RE: attachements types
[ Reply ]
not that I'm aware of. what files are you thinking about?
dave wanta [ dave ( at ) 123aspx dot com ],
2004-08-04 04:27:22
#
-
exception leaving attachment locked
[ Reply ]
I am using essentially the same code as the example to send an attachement. The attachement works fine in the normal case but if the call to SmtpMail.Send gets an exception (SMTP password is bad), it seems to leave the attached file open and therefore locked.
Has anyone else seen this? Any ideas on a solution?
Thanks! Steve VanHorn
Steve VanHorn [ steve ( at ) nuview dot com ],
2005-01-06 11:16:22
#
-
RE: exception leaving attachment locked
[ Reply ]
I found the same problem. When trying to send a Mail with attachment and e.g. the password was set wrong, the attched file is locked and can't be overwritten which is really bad.
Work arround could be to attach a temporary file where each time an other one is used for attachments. But that is not very elegant.
Has anybody a better solution?
Regards
louk
louk [ karim dot loukili ( at ) gmx dot de ],
2005-03-11 06:37:38
#
-
RE RE: exception leaving attachment locked
[ Reply ]
has anyone found a solution for this other than using temp files for the attachments?
Shawn [ shawn_work ( at ) hotmail dot com ],
2005-03-14 07:02:08
#
-
RE: RE RE: exception leaving attachment locked
[ Reply ]
Yes, I ahve the same problem. If the email send OK it frees the attachment, if it fails it locks the attachment and, since in my program this is an error log which is being constantly accessed, this causes me a problem. I tried the tempory file and copy over idea but that just got locked as well.
I also tried setting the send code in another thread an monitoring that but to no success
Apreciate anyones help.
Jon Weston [ jon dot weston ( at ) oakdatasystems dot com ],
2005-09-13 09:56:18
#
-
RE RE: RE RE: exception leaving attachment locked
[ Reply ]
You create an Attachment class which holds a reference to the file. Make sure that you dispose the attachment(s) in your Finally block and no more locks.
Richard [ roestenburg ( at ) hotmail dot com ],
2006-03-06 02:15:21
#
-
Cannot attach a file that I can copy
[ Reply ]
Hello,
I'm able to create a file (file1) then copy the file to a new filename using filecopy(file1, file2). Because I can write and read file1, and write the new file2 to a virtual directory I'm assuming I have proper rights.
File1 was created with server.mappath() file2 also was created with server.mappath()
After the filecopy I try to add file2 as a mail attachment, then add the rest of the mail values (to, from, body).
I then try to send the email. But no email sends at all. I do not get any error messages.
Any Ideas?
One thing I learnted is this same code used to work 3 months ago, but just stopped for some reason (I'm new on the job here).
Any advice is welcome!!! -- rodney :)
Rodney Johnson [ TheWizardRod ( at ) yahoo dot com ],
2005-02-08 09:05:39
#
-
The attachment is failing
[ Reply ]
I have used your method and included the System.IO and System.Web.MAil namespaces in my code but when sending the e-mail I get the error "Invalid mail attachment" . Please help
reubena [ 0834384144 ( at ) mtnice dot co dot za ],
2005-03-31 01:54:43
#
-
Want to attach file from network path
[ Reply ]
I am attaching file using a network UNC path name. It works in production server but not in localhost,
Any ideas? Permission issues?
Thanx
BVT [ binut ( at ) yahoo dot com ],
2005-05-23 08:24:28
#
-
Invalid mail attachment (images only)
[ Reply ]
I'm getting an Invalid mail attachment error when I try to attach image files, but have no problem attaching Word .doc files. Could this be happening because permissions for the ASP.NET process are configured for some file types, but not others? If so, how do I set permissions for the ASP.NET process? Thanks in advance.
Chris [ coconnor ( at ) sbl-site dot org ],
2005-06-23 08:06:12
#
-
RE: Invalid mail attachment (images only)
[ Reply ]
I did figure out how to add the ASPNET user to the applicable directory via IIS. I gave the ASPNET user Full Control permissions. Didn't help. Still getting the invalid mail attachment error for image files. I do not get this error for Word .doc files (so it's not a problem with the file path). Would appreciate any insight you may have.
Chris [ coconnor ( at ) sbl-site dot org ],
2005-06-23 12:25:53
#
-
How to Restrict Users
[ Reply ]
How can i Restrict user in my site for only an image attachment in *.jpg , *.gif or in *.bmp files without any document or excel sheet or any other files...
sunil
Sunil Nagar [ sunilngr ( at ) rediffmail dot com ],
2005-07-04 04:42:00
#
-
Authentication
[ Reply ]
this is my code, but it is not working if i run my App, but if i send a mail from outlook it work perfectly, does anyone have a sugestions.
private void btnSendMail_Click(object sender, System.EventArgs e) { MailMessage msg = new MailMessage(); msg.From = txtFrom.Text; msg.To = txtTo.Text; msg.Subject = txtSubject.Text; msg.Body = txtBody.Text;
// can be MailFormat.HTML msg.BodyFormat = MailFormat.Text; /* you can ignore following line for encoding, .NET will use your PC default text encoding */ msg.BodyEncoding = System.Text.Encoding.GetEncoding("iso-8859-2");
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport","25"); msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver","correo.etb.net.co");
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout",10);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","WilliamToro");
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword","44175612");
SmtpMail.Send(msg); //this line actually fire the msg out }
Luis Fernando Forero Guzman [ luisferforero ( at ) yahoo dot com ],
2005-07-07 10:05:43
#
-
File with Attachment sits in Queue
[ Reply ]
We are sending messages using Win32 Service build using .NET and C#. System.Web.Mail. If I send email it goes through. If I send one with a ZipFile as an attachment, I get no error when I do send, but it sits in the IIS SMTP Queue. I have reviewed the logs, and I can see where it connects to the remote server, but nothing gets sent. So we told it to encode UUEncode like below:
private void SendEmail(string ToAddress, string FromAddress, string Subject, MailFormat MailType, string Message, string SmtpServer, string ZipFile) { //send debit email notification try { // Create a New Message MailMessage oMsg = new MailMessage(); // From E-Mail Address oMsg.From = FromAddress;
// To E-Mail Address oMsg.To = ToAddress; // Create A Subject // oMsg.Subject = Subject;
// Set text format oMsg.BodyFormat = MailType;
//add an attachment if (!File.Exists(ZipFile)) return; // FileStream fs=null; try { MailAttachment MailAttach = new MailAttachment(ZipFile,MailEncoding.UUEncode);
oMsg.Attachments.Add(MailAttach); } catch(Exception ex) { ExceptionManager.Publish(ex); }
// Message body oMsg.Body = Message;
// SMTP server. SmtpMail.SmtpServer = SmtpServer;
SmtpMail.Send(oMsg); } catch(Exception ex) { ExceptionManager.Publish(ex); } }
When we do the mail goes through but it comes across on the other end not at as a file but like so
begin 666 Prudenti_456789_14_07_2005_10_50_28_579.zip M4$L#!!0````(`!EDWC(LT(!)2@$``(@'```.````4%)51$5.5$E!3"YC MU$MNPR 0!N!]I=Z!`XQJAI?QDJ34024FLJVZR?T/4D@W%LH#E&2V(_V,/L^8 MID(N$39V&.P\D_*"\6@&4E5PNP.JP0:[5H)@2I+!$B[F'=F63 6DM@*$K?'F M>N*7!RY$VV7QP%M)/Q+<^]N_GTI^8PC?;IC*WX>#[?MCUCX!2@=!, MDRD"R@AH?NPCV=>J$%#3+!Z$0KD&Y%HC'(SK"\9 MTT2(6&A8+[C 8MTX?1I_.?PLR.('S>*!);8U8 M+G6@;5 G00&'0#;AET@4[.'L:U5ZQ#J+!R$S0!T!3XNSD[=C^?NP#]X_?0?/ M@K(%I!V39%H(JL(S?IV@RN+C<-D.:B;B#H;1#J>:`6!O1E=Y^;<[<0?/@!0$ M933YE?*]$E!D\>O?X!]02P$"% `4````" `99-XR+-" 24H!``"(!P``#@`` M````````````````````4%)51$5.5$E!3"YC &=@$````` ` end
Any ideas????????????????
Vincent Mayfield [ mayfieldv ( at ) bit-wizards dot com ],
2005-07-14 09:18:26
#
-
RE: File with Attachment sits in Queue
[ Reply ]
I have same problem. Attachemnt is converted to inbody text like below
I am using UUEncoding
new MailAttachment(Attachments[i].ToString(), MailEncoding.UUEncode);
begin 666 Tplus1_CCMDailyPLReport_20070405_1.pdf M)5!$1BTQ+C(@"B7BX\_3( HQ(# @;V)J( H\/" *+U1Y<&4@+T-A=&%L;V<@ M"B]086=E<R R(# @4B *+U!A9V5-;V1E("]5<V5.;VYE( HO5FEE=V5R4')E M9F5R96YC97,@/#P@"B]&:717:6YD;W<@=')U92 *+U!A9V5,87EO=70@+U-I .....and so on.... *<W1A<G1X<F5F( HQ,S0P,S(@"B4E14]&( H` ` end
Ruchi [ RUCHI_GUPTA ( at ) COUNTRYWIDE dot COM ],
2007-04-09 11:13:22
#
-
Email Attachments
[ Reply ]
Hi
I am sending mails with HTML attachments through MSMQ using CDO.Message. the mails are working fine with all the servers except windows 2003. the service try to attach the HTML file but it keeps running unitl it is restarted and it is not giving any error message. also the mail is not sent.
If anyone has any idea please let me know ASAP.
Surabhi [ surabhi dot gupta ( at ) finalquadrant dot com ],
2005-07-14 23:03:35
#
-
Server.mappath error
[ Reply ]
Hi,
I followed the example for creating email attachments. My VB.net code editor come up with "Name 'server' not declared" for server.mappath
Adhir Sookraj [ asookraj ( at ) toyota dot co dot za ],
2005-09-28 02:00:37
#
-
RE: Server.mappath error
[ Reply ]
I have written the code but i'm gettin server error plz will u help me i findin
Saruna [ saruna_auradkar ( at ) rediffmail dot com ],
2006-02-02 01:37:45
#
-
how to upload the attachment to email
[ Reply ]
Hi!
Is there a way that the attachment comes from the user's machine?
agihcam [ m dot higa ( at ) yazaki-torres dot com ],
2005-12-09 17:34:00
#
-
abut Multi-Threading in ASP NET using C#
[ Reply ]
i am working on Mass Mailing System, but the time taking to send more mails is very slow. so we have decided to work on Multi-threading concept. can any one give the details, so that we can get good knowledge on Multi-Threading...
plz. do this favor
with regards, kiran kumar
Kiran Kumar [ hereitskiran ( at ) yahoo dot com ],
2006-01-03 22:48:09
#
-
Change the name of an attachment.
[ Reply ]
I am sending 2 attachments in an email, and both have the same name, just in different directories, and both consist of different data. Is there a way I can change the name of the attachment affter it is attached???????
Imad [ damiwork ( at ) yahoo dot com ],
2006-01-19 07:27:24
#
-
RE: Change the name of an attachment.
[ Reply ]
MailMessage msg = new MailMessage(); Attachment a = new Attachment("FILE PATH); msg.Attachments.Add(a); a.Name = "New name";
SmtpClient client ....... etc.
Will [ will_cpyress ( at ) hotmail dot com ],
2007-11-06 03:05:11
#
-
sending image as stream inside email-body
[ Reply ]
i need to to create a code, that sends an image inside a mail. the problem is: the image stays only for 20 minutes on the server. so, sending the image as a normal attachement won't help a lot as in most cases, the image will already be deleted by time the client reads his mail...
so i thought about reading the image to a memorystream and sending this stream inside the body of the mail.
has anybody an idea, how this could be done?
best regards
george [ georg dot andersson ( at ) geo dot stzh dot ch ],
2006-03-10 03:06:11
#
-
create temp file in client side
[ Reply ]
i want to attached a html file. this html file is crate dinamicly in run time. i don't no where i store this file and how can i attached this file with my mail
vipin paliwal [ vipinpaliwal1980 ( at ) sify dot com ],
2006-03-29 23:34:22
#
-
Send url in mail message.
[ Reply ]
I want to send the url with querystring with mail message body. Is it possible? or shall i use other way, suggest me
k.bhavani [ kabhavanimca ( at ) yahoo dot co dot in ],
2006-05-25 21:56:52
#
-
How to give a different name to attachment
[ Reply ]
I want to give a different name to the attachments while sending them. Is there a way to do it while attaching them?
Leena [ leena_nk ( at ) hotmail dot com ],
2006-07-10 14:14:59
#
-
How to give a different name to attachment
[ Reply ]
I want to give a different name to the attachments while sending them. Is there a way to do it while attaching them?
Leena [ leena_nk ( at ) hotmail dot com ],
2006-07-10 16:13:10
#
-
RE: How to give a different name to attachment
[ Reply ]
I am trying to do this as well. I have an application where I allow users to email with attachments, but I rename these attachments with a timestamp (unique name) in the file folder. I do not want the unique name to be displayed to the users whor eceive the emails. How do I do that?
Taha [ tahadude ( at ) yahoo dot co dot uk ],
2006-10-27 09:47:06
#
-
Problem: HTML email body and encoded attachment
[ Reply ]
Hi all, My code is like:
MailMessage mail = new MailMessage(); mail.To = "me@mycompany.com"; mail.From = "you@yourcompany.com"; mail.Subject = "this is a test email.";
mail.BodyFormat = MailFormat.Html; mail.Body = "this is my test email body.<br><b>this part is in bold</b>";
// I had to use UUEncode other my attachments // would get crrupted. mail.Attachments.Add(new MailAttachment(filename,MailEncoding.UUEncode));
SmtpMail.SmtpServer = MY_SMTP_SERVER; SmtpMail.Send( mail );
Now the problem is that when i receive the email the attachment is ok but the email is sent as "Plain Text" not "HTML"! Does anyone know why?
Sam [ sam dot arjmandi ( at ) mgaconsulting dot ca ],
2006-07-27 12:36:58
#
-
optional attachment
[ Reply ]
How can i make the attachment as optional in .net mail sending
sabita [ sabitamsahoo ( at ) gmail dot com ],
2006-10-07 00:43:19
#
-
RE: optional attachment
[ Reply ]
do it with if else statement if (txtAttachment.Value == "") { message.IsBodyHtml = false; message.Body = txtMessage.Text;
} else { Attachment attach = new Attachment(txtAttachment.Value); IList msgAttachments = message.Attachments; msgAttachments.Add(attach); message.IsBodyHtml = false; message.Body = txtMessage.Text; }
saurabh [ sbsw31 ( at ) yahoo dot co dot in ],
2006-11-06 23:04:52
#
-
Awesome
[ Reply ]
Awesome guides - Thank you so much Dave!
m(_ _)m
JH [ aestivial ( at ) hotmail dot com ],
2006-11-07 00:04:01
#
-
Attachmen can't open after receiving email
[ Reply ]
hi all,
I'm using Web.Mail to send email with attachment, my attachment is PDF type. As I sent this message is successfully but when I open the attachment (PDF), I have the error: " There was a problem reading this document (114)".
This file is not giving me problem as I open from its destination (UNC). What problem do you think I have wrong here... Below is my code.
MailMessage mailMessage = new MailMessage(); mailMessage.From = Home; mailMessage.To = Me; mailMessage.Subject = Test; mailMessage.Attachments.Add(new System.Web.Mail.MailAttachment(PathofPDF)); string smtpServer = System.Configuration.ConfigurationSettings.AppSettings["SMTPServer"]; System.Web.Mail.SmtpMail.SmtpServer = smtpServer; System.Web.Mail.SmtpMail.Send(mailMessage);
Bob [ bobbivu ( at ) hotmail dot com ],
2007-05-31 08:59:31
#
-
question
[ Reply ]
problem in sending email with file attachment
Ramesh [ kramesh243 ( at ) yahoo dot com ],
2007-07-06 07:01:25
#
-
Attaching file on client computer
[ Reply ]
How to attach file from client computer
Mani [ mani dot gajula9 ( at ) gmail dot com ],
2007-08-14 20:39:55
#
-
Email with attachment published on IIS
[ Reply ]
Hi,I want to send email with attachment in web application and my website is located on IIS and hence its not supporting the directory path I am providing.Please tell me how to give the path when the website is located on IIS.Thanks.
Ritu [ risaxena ( at ) vectorform dot com ],
2008-02-05 06:16:21
#
-
RE: Email with attachment published on IIS
[ Reply ]
Hi, You probably are just having an issue resolving the path.
Try referencing the path using the Server.MapPath(...) method.
Cheers! Dave
dave wanta [ dave ( at ) advancedintellect dot com ],
2008-02-05 06:35:11
#
-
mail attachment
[ Reply ]
Hi, I am using .NET2.0 I m sending email with .zip file as attachments. But it is working only for files those are less than one mb. I the file size is more than one mb it is giving 'timed out' error. What steps should i follow. please help me
Ujjwal [ uj dot meshram ( at ) gmail dot com ],
2008-08-06 06:48:39
#
-
Attachments
[ Reply ]
I'm trying to sell my Bike [ Motercycle ] and I'm Wondering if its possible to attach a Picture so he can see what my Bike looks like, Any help?
Josh [ Sk dot 8 dot terboy87 ( at ) hotmail dot com ],
2008-08-13 10:27:41
#
-
PDF format
[ Reply ]
hello Sir , how to create PDF format file directly and send it file by mail attachment . So give me answered.
Nitin vijay [ nitin dot vijay dot engg ( at ) gmail dot com ],
2008-12-29 01:17:15
#
-
RE: PDF format
[ Reply ]
how do i send email in a pdf format
DENISE [ feb ( at ) telkomsa dot net ],
2009-09-10 23:32:01
#
-
Sending emails
[ Reply ]
I am sending embedded images in email. When i embed a image twice then one is send as attachment. I dont require image to be send as attachment.
Regards, Priya
Priya [ aries25priya ( at ) gmail dot com ],
2009-01-29 01:32:20
#
-
Different attachments to diff ids
[ Reply ]
Could you please help me in sending different attachement to differet e mail ids through mail merging (quickely)
murali [ holdings ( at ) sarlagroup dot com ],
2009-10-06 23:30:41
#
|