I have been trying to integrate sendGrid with PHPList. Sad I couldn't find any latest article / document on same.
I tried changing config/config.php file. here is the code [edits],
define('PHPMAILERHOST', 'smtp.sendgrid.net');
$phpmailer_smtpuser = 'uname';
$phpmailer_smtppassword = 'pass';
define("PHPMAILER_SECURE",'tls');
## you can set this to send out via a different SMTP port
define('PHPMAILERPORT', 587);
I also tried to edit setupdir/admin/phpMailer/class.phpmailer.php. Here is how it looks [changed lines],
public $Host = 'smtp.sendgrid.net';
public $Port = 587;
public $Helo = '';
public $SMTPSecure = 'tsl';
public $SMTPAutoTLS = true;
public $SMTPAuth = true;
public $Username = 'myusername';
public $Password = 'mypass';
I tried both but its not working. Can someone point me to exact place I need to change code?
Thanks,
You've got TSL in the config instead of TLS.
Related
This is the issue what i am facing
Localhost
Test mail with SMTP settings work
New user creation mail using the above smtp settings work
Server
Test mail with SMTP settings work
New user creation mail using the above smtp settings doesn't work
I echoed the mail smtp settings in both the cases and they are exactly same. The error i am getting is
SMTP -> ERROR: Failed to connect to server: php_network_getaddresses:
getaddrinfo failed: Name or service not known (0)SMTP Connect()
failed.
Any suggestions would be helpful.
I further debug it. The behavior turns out to be wierd
if (isset($_POST['User']))
{
if (UserUtil::validateAndSaveUserData($model, $_POST))
{
$mailer = new UiMailer();
$mailer->setFrom('fromAddress', 'fromName');
$mailer->setTo('toaddress');
$mailer->setSubject('Test subject');
$mailer->setBody('Test Body');
$mailer->Mailer = 'smtp';
$mailer->Username = 'username';
$mailer->Password = 'password';
$mailer->Host = 'host';
$mailer->Port = 25;
$mailer->SMTPAuth = true;
$status = $mailer->send() ? true : false;
if($status == true)
{
print "Sucess";
}
else
{
print $mailer->ErrorInfo . "</br>";
print "Failuere";
}
exit;
}
}
If i comment the call if (UserUtil::validateAndSaveUserData($model, $_POST)), it works fine. In the function i am validating and saving models using Yii framework. I further debug the function. I have the following relation in the system
User has one person
User has one address
So in the above call, if i comment the address part which $model->address->attributes or $model->address->validate or $model->address->save(), it works fine. The save functionality for address works fine. There are no issues related to it.
I'd like to configure a Pylons app, so that I get email on unhandled exceptions.
So far I can't find the way to pass username and password for SMTP connection.
production.ini file:
..
[DEFAULT]
email_to = my_email#gmail.com
smtp_server = smtp.webfaction.com
error_email_from = info#mydomain.com # this'd be a working email on webfaction
..
Please help.
If you want to access them in pylons.config then you want to put them in the [app:main] section of the configuration.
I've used turbomail, and then you can put them in [DEFAULT]. This is what my config looked like.
[DEFAULT]
mail.on = true
email_to = toaddress#domain.com
mail.manager = immediate
mail.transport = smtp
mail.provider = smtp
mail.smtp.server = smtp.domain.com
mail.smtp.username = username#domain.com
mail.smtp.password = passwordhere
error_email_from = paste#localhost
I am trying to send Email from an asp.net webform using Gmail.
the code works from my machine but when I upload the code to my windows server 2012 in Azure I get
Unable to connect to Remote Server - exception
here is my code:
MailMessage mail = new MailMessage();
mail.Subject = "Subject";
mail.Body = "Main body goes here";
mail.From = new MailAddress("myAcount#gmail.com");
mail.IsBodyHtml = true;
mail.BodyEncoding = System.Text.Encoding.Unicode;
mail.SubjectEncoding = System.Text.Encoding.Unicode;
mail.To.Add("aaaa#gmail.com");
NetworkCredential cred = new NetworkCredential("myAccount#gmail.com", "myPwd");
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.EnableSsl = true;
smtp.Credentials = cred;
smtp.Port = 587;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(mail);
Any ideas?
Make sure the local VM's Firewall rules are permitting outgoing connection via port 587. Here is a good article on how to create outbound Firewall rule.
I am trying to get the classic ASP page working with Outlook (Microsoft Web Email) SMTP relay. I am getting the following error :
CDO.Message.1 error '80040213'
The transport failed to connect to the server.
My code looks like
dim objEmail
Set objEmail = Server.CreateObject("cdo.message")
objEmail.To = list
objEmail.From = "xyz#abc.com"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = username
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = password
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
objEmail.Configuration.Fields.Update
objEmail.Send
I tested with GMAIL and this thing snippet works fine with it. I guess I am missing something in configuration of Outlook SMTP
Here is an example that does work. Make sure that the account you use has a mailbox, and the from adress is indeed the account adress.
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
var msg = new MailMessage();
msg.Subject = "Hello";
msg.Body = "Hello Sir";
msg.From = new MailAddress("no.reply#contoso.com");
msg.To.Add("user#contoso.com");
var client = new SmtpClient("smtp.outlook.office365.com");
client.Port = 587;
client.Credentials = new NetworkCredential("no.reply#contoso.com", "******");
client.EnableSsl = true;
client.Send(msg);
I have configured my application to work with multiple databases. The magic works just fine. In my Bootstrap.php I have defined the folowing:
protected function _initDb()
{
$resource = $this->getPluginResource('multidb');
Zend_Registry::set("multidb", $resource);
}
and in my application.ini:
resources.multidb.db1.adapter = mysqli
resources.multidb.db1.host = localhost
resources.multidb.db1.username = user
resources.multidb.db1.password = pass
resources.multidb.db1.dbname = db
resources.multidb.db1.charset= "utf8"
resources.multidb.db1.default= true
resources.multidb.db1.profiler.enabled = true
resources.multidb.oracle.adapter = oracle
resources.multidb.oracle.username = user
resources.multidb.oracle.password = pass
resources.multidb.oracle.charset= "utf8"
resources.multidb.oracle.dbname = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(Host = host.example.com) (Port = 1529)) (CONNECT_DATA = (SID = DB)))"
resources.multidb.oracle.profiler.enabled = true
All of this works just fine. In my models, I usually do something like this in the init():
$multidb = Zend_Registry::get("multidb");
$this->oracle = $multidb->getDb('oracle');
But I recently wanted to move this part to the Bootstrap, or rather, Registry, like this:
protected function _initDb()
{
$resource = $this->getPluginResource('multidb');
Zend_Registry::set("multidb", $resource);
Zend_Registry::set("odb",$resource->getDb('oracle'));
}
And this is what happened:
Fatal error: Uncaught exception 'Zend_Application_Resource_Exception' with message 'A DB adapter was tried to retrieve, but was not configured' in C:\Zend\Apache2\htdocs\Zend\Application\Resource\Multidb.php on line 135
I know a temporary fix around this, but why is this happening, and what could be a more long term fix, so that I could set each adapter in registry, preferably in bootstrap?
Thanks!
I think you have to make sure the multidb resource is bootstrapped in other to be filled. You can do this with the following:
protected function _initDb() {
$this->bootstrap('multidb');
$resource = $this->getPluginResource('multidb');
Zend_Registry::set("multidb", $resource);
Zend_Registry::set("odb",$resource->getDb('oracle'));
}