PHP Classes

Problem in sending emails through SMTP classes

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Problem in sending emails through...  
Subject:Problem in sending emails through...
Summary:Problem in sending emails through SMTP classes
Messages:11
Author:RSI Concepts
Date:2012-07-31 08:32:53
Update:2012-08-23 09:17:32
 

  1. Problem in sending emails through...   Reply   Report abuse  
Picture of RSI Concepts RSI Concepts - 2012-07-31 08:32:53
I am connecting to a remote server using proper email address and password and trying to use their SMTP email server for sending emails from that server but it is giving me errors.

Below is few sample of examples tried :

rsidemos.com/hfzasms/smtp1/
rsidemos.com/hfzasms/smtp2/

Both of them are giving connection errors.

At the same time - i am doing the same email sending activity using C# code and it is working fine. Below is the C# code i am using :

___________________________________________________________________________

public static bool SendEmail(string msgTo, string msgSubject, string msgBody, bool isBodyHTML,out string Err,string Heading)
{
Err = string.Empty;
SmtpClient scFMSMail = new SmtpClient();
scFMSMail.Host = "mail.domain.com"; scFMSMail.EnableSsl = true;
scFMSMail.UseDefaultCredentials = false; scFMSMail.Port = 587;
scFMSMail.Credentials = new NetworkCredential("username", "password");
MailMessage FMSMail = new MailMessage();
FMSMail.To.Add(new MailAddress(msgTo));
FMSMail.Subject = msgSubject;
FMSMail.From = new MailAddress("abc@abc.com");
FMSMail.Body = msgBody;

try
{
scFMSMail.Send(FMSMail);

}
catch (Exception ex)
{
Err = ex.Message;
}
if (Err.Length == 0)
return true;
else
return false;
}


___________________________________________________________________________

Can anyone advise on the reason - why is it working fine in c# and not in php? I can also share the php code but those are multiple files and there is no file uploading facility here

There are 10 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.