Click here to Skip to main content
16,008,490 members

Comments by manjukgowda (Top 11 by date)

manjukgowda 11-Jun-13 8:23am View    
using System.Web.Mail;

public static bool SendEmail(string EmailId, string Password, string To, string Subject, string Body, string AttachmentPath)
{
EmailId = EmailId.EndsWith("yahoo.in") ? EmailId.Replace("yahoo.in", "yahoo.com") : EmailId;
string server = null;
string port = null;
if (EmailId.Contains("gmail"))
{
server = "smtp.gmail.com";
port = "465";
}
else if (EmailId.Contains("yahoo"))
{
server = "smtp.mail.yahoo.com";
port = "465";
}
else if (EmailId.Contains("hotmail"))
{
server = "smtp.live.com";
port = "25";
}
else
{
server = "smtp.aol.com";
port = "465";
}
try
{
MailMessage myMail = new MailMessage();
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpserver",
server);
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
port);
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/sendusing",
"2");

myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//Use 0 for anonymous
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/sendusername",
EmailId);
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/sendpassword",
Password);
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpusessl",
"true");
myMail.Priority = MailPriority.High;

myMail.From = EmailId;
myMail.To = To;
myMail.Subject = Subject;
myMail.BodyFormat = System.Web.Mail.MailFormat.Html;
myMail.Body = Body;
if (AttachmentPath.Trim() != "")
{
MailAttachment MyAttachment = new MailAttachment(AttachmentPath);
myMail.Attachments.Add(MyAttachment);
}
SmtpMail.SmtpServer = string.Format("{0}:{1}", server, port);
SmtpMail.Send(myMail);
return true;
}
catch
{
return false;
}
}

manjukgowda 23-Jul-12 6:08am View    
Can u please help me to do this, i'm very disappointed from morning
manjukgowda 23-Jul-12 6:07am View    
:)
manjukgowda 23-Jul-12 5:59am View    
Yes got correct result when i executed the query in query window


My stored procedure also gives correct result when i executed as follows

exec selectemployeebyids(101,102,103,104)

- Gives correct result i.e all employees 101,102,103,104


exec selectemployeebyids('101,102,103,104')

- gives result only for employee id 101
manjukgowda 23-Jul-12 5:39am View    
http://www.codeproject.com/Articles/6083/Passing-comma-delimited-parameter-to-stored-proced#_rating


Here i got a solution that works in sqlserver superbly but i'm unable to do it mysql


Use Northwind

Go
-- @IDs is the string of comma delimited integers
-- (you can increase the size if you think that your array will be very large)
-- After parsings the string, integers are returned in a table


CREATE Function fnSplitter (@IDs Varchar(100) )
Returns @Tbl_IDs Table (ID Int) As

Begin
-- Append comma
Set @IDs = @IDs + ','
-- Indexes to keep the position of searching
Declare @Pos1 Int
Declare @pos2 Int

-- Start from first character
Set @Pos1=1
Set @Pos2=1

While @Pos1