Folks,
I've been experiencing a weird problem. I have a web service which sends an
email after its processing. The email always has an PDF attachment on it.
The PDF size vary overtime.
The problem is that everytime the PDF size is equal to or less than 200 KB,
the email is just not being sent. There are no error messages, nothing.
Here is a piece of code.
[WebMethod]
public string TestSendEmail(s tring email)
{
string[] files = Directory.GetFi les(@"c:\temp", "*.pdf");
for(int i = 0; i < files.Length; i++)
{
MailMessage msg = new MailMessage(new
MailAddress("te **@mydomain.net "), new MailAddress(ema il));
msg.Subject = "test";
msg.Body = "test";
try
{
Attachment at = new Attachment(file s[i]);
msg.Attachments .Add(at);
}
catch (Exception ex)
{
EventLog.WriteE ntry("test", ex.ToString(),
EventLogEntryTy pe.Error);
}
SmtpClient c = new SmtpClient("mys mtpserverIP");
c.Send(msg);
}
return "success";
}
What happens is that all attachments which size is bigger than 200KB are
sent normally. The other files, don't
Any thoughts?
--
Regards,
Robson Siqueira
Enterprise Architect 2 5265
Hi,
Sometimes some spam filters block pdf, at least for me.
May be its wise to zip ti before you send pdf.
Or alternatively you can try: http://www.lumisoft.ee/lswww/downloa...oads/Examples/
(smtp example)
to see if that native smtp lib acts same.
"Robson Siqueira" <ro****@robsonf elix.comwrote in message
news:Oz******** ******@TK2MSFTN GP05.phx.gbl...
Folks,
I've been experiencing a weird problem. I have a web service which sends
an email after its processing. The email always has an PDF attachment on
it. The PDF size vary overtime.
The problem is that everytime the PDF size is equal to or less than 200
KB, the email is just not being sent. There are no error messages,
nothing.
Here is a piece of code.
[WebMethod]
public string TestSendEmail(s tring email)
{
string[] files = Directory.GetFi les(@"c:\temp", "*.pdf");
for(int i = 0; i < files.Length; i++)
{
MailMessage msg = new MailMessage(new
MailAddress("te **@mydomain.net "), new MailAddress(ema il));
msg.Subject = "test";
msg.Body = "test";
try
{
Attachment at = new Attachment(file s[i]);
msg.Attachments .Add(at);
}
catch (Exception ex)
{
EventLog.WriteE ntry("test", ex.ToString(),
EventLogEntryTy pe.Error);
}
SmtpClient c = new SmtpClient("mys mtpserverIP");
c.Send(msg);
}
return "success";
}
What happens is that all attachments which size is bigger than 200KB are
sent normally. The other files, don't
Any thoughts?
--
Regards,
Robson Siqueira
Enterprise Architect
Folks,
Problem was found. If you don't specify the MIME type for attachments which
size is less than 200 KB (at least in our case, using .Net 2.0 and a
Microsoft SMTP server), the server just ignores the email.
So we changed the code to
Attachment at = new Attachment(file s[i],
System.Net.Mime .MediaTypeNames .Application.Pd f);
Now works perfectly.
If you guys find articles or any information about it, please let me know.
--
Regards,
Robson Siqueira
Enterprise Architect
"Robson Siqueira" <ro****@robsonf elix.comwrote in message
news:Oz******** ******@TK2MSFTN GP05.phx.gbl...
Folks,
I've been experiencing a weird problem. I have a web service which sends
an email after its processing. The email always has an PDF attachment on
it. The PDF size vary overtime.
The problem is that everytime the PDF size is equal to or less than 200
KB, the email is just not being sent. There are no error messages,
nothing.
Here is a piece of code.
[WebMethod]
public string TestSendEmail(s tring email)
{
string[] files = Directory.GetFi les(@"c:\temp", "*.pdf");
for(int i = 0; i < files.Length; i++)
{
MailMessage msg = new MailMessage(new
MailAddress("te **@mydomain.net "), new MailAddress(ema il));
msg.Subject = "test";
msg.Body = "test";
try
{
Attachment at = new Attachment(file s[i]);
msg.Attachments .Add(at);
}
catch (Exception ex)
{
EventLog.WriteE ntry("test", ex.ToString(),
EventLogEntryTy pe.Error);
}
SmtpClient c = new SmtpClient("mys mtpserverIP");
c.Send(msg);
}
return "success";
}
What happens is that all attachments which size is bigger than 200KB are
sent normally. The other files, don't
Any thoughts?
--
Regards,
Robson Siqueira
Enterprise Architect This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian Farnhill (MCP VB.NET) |
last post by:
Hi,
I am having some trouble using the MailMessage object to send an email with
more than one attachment.
I am working on a web based application where a user can submit information,
along with a number of files. The information, including the file is stored
in the database, and an email is sent with the information and any files that
were submitted are attached. The system works fine when a user makes a
submission that has no...
|
by: HoustonComputerGuy |
last post by:
I am working on getting my web applications moved to .Net 2.0 and am
having some problems with System.Net.Mail. I get the following error
when sending the mail:
System.Net.Mail.SmtpException was unhandled by user code
Message="Failure sending mail."
Source="System"
StackTrace:
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at System.Net.Mail.SmtpClient.Send(String from, String
|
by: Joe Reiss |
last post by:
Hi all,
I'm using the System.Net.Mail namespace to set up a SMTP sendmail. This
works for the most part, however, when I try to send email to a cell phone
text msg. via the Verizon 'vtext' Gateway it fails with a 550 relay error
msg.
I've had this problem in the past with Delphi/Indy SMTP component. The
problem there was that the component was blacklisted by Verizon for previous
use by spammers. The fix was to get rid of the...
|
by: Opa |
last post by:
Hi,
I'm trying to send mail from my ASP.NET application using the new
System.Net.Mail classes.
The code is fairly basic
string SMTPServer = "smtp.atlanticbb.net";
SmtpClient client = new SmtpClient(SMTPServer);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send("sender@yahoo.com", "recipient@yahoo.com","test", "test");
|
by: Eric Sheu |
last post by:
Greetings,
I have been searching the web like mad for a solution to my SMTP problem. I
am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a
web site I have created to the members of my organization. I think my problem
is incorrectly setting the settings on my server or an authentication
problem. Here is the code I have written to send a test message:
-----Code Begins: Sensitive Information Replaced by -----...
| |
by: Brad |
last post by:
I have a web .Net app which sends emails with attachments. After the email
is sent I clean up aftermyself and delete the attachments from disk. In
upgrading to .Net 2 I changed the email logic from using system.web.mail to
system.net.mail (of course vs is telling me system.web.mail is obsolete).
In .Net 1.1, the files deleted with no problem but in .Net 2 when I attempt
to delete I receive
The process cannot access the file ...'...
|
by: maflatoun |
last post by:
Hi everyone,
I'm coverting some of our code here from the old way of send email in
..net 1.1 to the new .net 2.0. However, everyone I switch the code the
new method there is a delay of 1-2 minutes before an email is sent
(this is on my local computer point to my local smtp -> localhost).
Anyone knows what the problem could be? BTW my computer in located
behind a firewall and I'm sending test emails to my gmail account and
hotmail...
|
by: Claire |
last post by:
I'm a noob at emailing from code and I need to add email capabilities to my
application.
The following code completes without exceptions but I'm not receiving any
test emails.
How do you debug this? Ive checked my bad mail folder, and other IIS similar
folders and they're empty.
Can the mail classes be used without having a SMTP server running on
localhost? Can you use any smtp server that's capable of being set up from a
PC, e.g. an ISP...
|
by: Ed Bitzer |
last post by:
I have been able using the namespace System.Web.Mail and its method
Smtp.mail.send to mail simple text messages to a small group within
our 55 and older community. I need help expanding the programs
capabilities. Searching this forum I did not find any related
information so if I have chosen poorly, I would appreciate a
suggestion of a more appropriate dotnet forum.
Now what I wish is the ability to send bcc's rather than to: (would be...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |