error sending mail using system.net.mail

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2007
Posts: 144
Reputation: emilio is an unknown quantity at this point 
Solved Threads: 0
emilio emilio is offline Offline
Junior Poster

error sending mail using system.net.mail

 
0
  #1
Jan 16th, 2009
hi I'm trying to use this code that i found to send an email message using c# application.
i have an iis service running on my computer and the smtp server is configured as my providers smtp server.

the problem is that when i try to send mail i get an error message:
"the specified string is not in the form required for an e-mail address"

i swear to god that i insert a valid mail address.

my code is:

  1. MailMessage message = new MailMessage(to, from, subject, mess);
  2. SmtpClient client = new SmtpClient("mail.bezeqint.net");
  3. client.UseDefaultCredentials = true;
  4. client.Send(message);
  5.  
  6. return "Message sent to " + to + " at " + DateTime.Now.ToString() + ".";

help please.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 276
Reputation: rapture has a spectacular aura about rapture has a spectacular aura about 
Solved Threads: 37
rapture rapture is offline Offline
Posting Whiz in Training

Re: error sending mail using system.net.mail

 
0
  #2
Jan 16th, 2009
your 'from' is a valid email address as well not just a name?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 144
Reputation: emilio is an unknown quantity at this point 
Solved Threads: 0
emilio emilio is offline Offline
Junior Poster

Re: error sending mail using system.net.mail

 
0
  #3
Jan 16th, 2009
you're right the from name was not valid.

but now it's sending the message but it does not arrive.

any ideas ?
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: error sending mail using system.net.mail

 
0
  #4
Jan 16th, 2009
Are the from/to addresses local to the mail server, eg, you arent trying to relay?
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 144
Reputation: emilio is an unknown quantity at this point 
Solved Threads: 0
emilio emilio is offline Offline
Junior Poster

Re: error sending mail using system.net.mail

 
0
  #5
Jan 16th, 2009
the mails are not local.
i guess i tried many options and i dont know which one one is right.
i tried to configure the iis smtp server to my isp and i entered my password, when i tried to send it showed an error that access was denied.
i tried to reset all settings and defined the relay on 127.0.0.1 (local host). nothing seems to work.
is there any way to send emails with the iis default smtp server ?
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: error sending mail using system.net.mail

 
0
  #6
Jan 16th, 2009
Look I've experience about that, I never ever use SMTP to send emails because I am sure the destination would be the JUNK! I use CDO (Microsoft CDO for Windows 2000 library) instead.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 144
Reputation: emilio is an unknown quantity at this point 
Solved Threads: 0
emilio emilio is offline Offline
Junior Poster

Re: error sending mail using system.net.mail

 
0
  #7
Jan 16th, 2009
ok i looked for Microsoft CDO for Windows 2000 library and i found some code that should do the job:

  1. CDO.Message oMsg = new CDO.Message();
  2. CDO.IConfiguration iConfg;
  3.  
  4. iConfg = oMsg.Configuration;
  5.  
  6. ADODB.Fields oFields;
  7. oFields = iConfg.Fields;
  8.  
  9. // Set configuration.
  10. ADODB.Field oField = oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"]
  11.  
  12. oField = oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"];
  13. oField.Value = 1;
  14.  
  15. oMsg.Subject = "Test";
  16. oMsg.From = from;
  17. oMsg.To = to;
  18. oMsg.Send();

is there any other configuration i should do ?
cause i ran the code (doesn't seem to do anything).
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: error sending mail using system.net.mail

 
0
  #8
Jan 16th, 2009
Originally Posted by emilio View Post
the mails are not local.
i guess i tried many options and i dont know which one one is right.
i tried to configure the iis smtp server to my isp and i entered my password, when i tried to send it showed an error that access was denied.
i tried to reset all settings and defined the relay on 127.0.0.1 (local host). nothing seems to work.
is there any way to send emails with the iis default smtp server ?
Then it sounds quite simply as the servers not prepared to hand it on because neither the sender or receiver are domains it controls and its not an open realy.

Which is normal. Most servers these days are configured that way to reduce spam.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 46
Reputation: BlackSun is an unknown quantity at this point 
Solved Threads: 4
BlackSun BlackSun is offline Offline
Light Poster

Re: error sending mail using system.net.mail

 
0
  #9
Jan 18th, 2009
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 136
Reputation: cVz is an unknown quantity at this point 
Solved Threads: 7
cVz's Avatar
cVz cVz is offline Offline
Junior Poster

Re: error sending mail using system.net.mail

 
0
  #10
Jan 19th, 2009
No way man ... you can do this

  1. mail.Priority = MailPriority.High;

or

  1. mail.Priority = MailPriority.Normal;

works like a bombbbbbbb
Delphi & C# programmer deluxe...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC