Link to home
Start Free TrialLog in
Avatar of SirReadAlot
SirReadAlot

asked on

Operator '==' cannot be applied to operands of type 'void' and 'bool'

Hi experts,

just trying to turn this smtp.Send(msg); into a boolean condition

   smtp.Send(msg);
         
            if (smtp.Send(msg) ==false)===========this line errors
            {
                Console.WriteLine("UnSuccessfull");
                Console.ReadLine();
            }
            Console.WriteLine(" Successfull");

how do i proceed
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SirReadAlot
SirReadAlot

ASKER

ok. back to this.

smtp has no other property to state if items is delivered or not. but i  found this  class SmtpFailedRecipientsException which throws an exception if nothing was thrown
hi angel,

i think i fixed the problem by using this  smtp.SendAsync(mail, null);.

         SendAsync==Sends the specified e-mail message to an SMTP server for delivery. This method does not block the calling thread and allows the caller to pass an object to the method that is invoked when the operation completes.

however is it wrong to use null

thanks