I am using PHPMailer 5.2.0 for sending mail from localhost using my GMAIL account, it works perfectly, but when I hosted whole contents to a free sub-domain in getmeleave.orgfree.com, I get a error message as follows
SMTP Error: Could not connect to SMTP host.
Please give me solution for this, as it is my final year project.
Thank you
In many case with this issue, Solution like lack of SSL support in PHP. So you need to enable like:
extension=php_openssl.dll
If not solve this?. I suggest you to enable the SMTP debug available on the SMTP configuration page and then try to send an email. It will give you a more detailed story of why you can't send the message.
$mail->SMTPDebug = 1;
Once you set true it will report you what is the SMTP error.
Related
I am trying to send email from the server but it's not sending it throws an error. In phpinfo() I checked mail function is enabled, what's wrong why mail is not sending if anybody has idea means please tell me,
This is my code,
<?php
$msg = "test cotent";
$send =mail("xxxxx#gmail.com","My subject",$msg);
if($send) echo 'sent!';
else echo $errorMessage = error_get_last()['message'];
?>
Error,
mail(): SMTP server response: 554 5.7.1 : Relay access denied
See the answer, may be it will help you.(Please see the last one)
Relay access denied on sending mail, Other domain outside of network
https://jefferyland.wordpress.com/2013/05/28/essential-exchange-troubleshooting-send-email-via-telnet/
Use PHP MAILER for cross domain mailing that way you can define your ports or if you still want to use mail Function you'll have to set up an email with your hosting eg abc#yourdomain.com else it wont allow you to send. mail function uses default mailer hosting urls
mail() function unable to connect with you SMTP that's why you are getting this problem.
To solve this problem you can use PHP MAILER library which is available in GitHub. Using php mailer you can define SMTP, PORT etc.
Either you can create a web mail in your server (info#example.com) and use it in your code.
Hope it will help you to send mail.
I'm getting an error like :
Notice
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
×
Error
Test mail could not be sent.
My Email Setting as below,
I'm able to telnet my email host. Application is hosted in Linux Server.
hi if you are using Gmail account
refer https://www.lifewire.com/what-are-the-gmail-smtp-settings-1170854
if any other smtp service ask your host provider
Okay, I'm at my whit's end here. I have a client whose site is hosted on GoDaddy and that uses Outlook. I've written a PHP script to send mail to one of their domain e-mail addresses from a contact form on their website.
I can get this e-mail to send to every single service except outlook/exchange/live/microsoft accounts.
I read that using PHPMailer was a good idea, so this is what I'm currently using to send mail:
//$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "a2plcpnl0287.prod.iad2.secureserver.net";
$mail->Port = 465;
$mail->Username = "test#alamohomefinance.com";
$mail->Password = "xxxxxxx";
$mail->SetFrom('yourname#yourdomain.com', 'First Last');
$mail->AddReplyTo("name#yourdomain.com","First Last");
$mail->Subject = "PHPMailer Test Subject via smtp (hotmail), basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->MsgHTML($body);
$address = "jakerevans2#live.com";
if(!$mail->Send()) {
error_log("Error from calculator!". $mail->ErrorInfo);
} else {
error_log("Success from calculator!");
}
This e-mail gets sent to my gmail account and some others, but not to my .live account or my client's Outlook address.
I've tried everything I've found on the internet so far, nothing is working. Any ideas or thoughts anyone?
Thanks!
EDIT:
The Godaddy server has an SPF record that reads: v=spf1 include:spf.protection.outlook.com -all
I've created a DKIM key from https://www.port25.com/dkim-wizard/ and added a DKIM TXT record to GoDaddy, with the following details:
Host: key1._domainkey.alamohomefinance.com
TXT Value: k=rsa\; p=MIIBIjA...
I've added a DKIM record, with the following details:
Name: _dmarc.alamohomefinance.com
TXT Value: v=DMARC1; p=quarantine; sp=none; ruf=mailto:user#example.com; rf=afrf; pct=100; ri=86400
Am testing now to see if these changes make a difference...
First up, you should look at the PHPMailer troubleshooting guide, which has a little section on GoDaddy, and many other problems.
You will get much better feedback on what's going on if you enable debug output of server messages, so set SMTPDebug = 2, and see what it says.
GoDaddy is known to block outbound SMTP, and generally will either simply fail to connect (see many questions on SO about that), or cause TLS verification failures as you get redirected transparently to their mail servers.
In your code you've got the smtp.live.com Host, but this username:
$mail->Username = "a2plcpnl0287.prod.iad2.secureserver.net"
secureserver.net is the domain used for GoDaddy's mail servers, and that user name is the name of an actual GoDaddy mail server, so it seems very unlikely that you should be using it as a user id for live.com, especially since GoDaddy will be rotating mail servers frequently, so you're unlikely to get the same one every time - is that really your login ID for live.com?
I'm also suspicious of the phrasing of your question: you do not need to connect to live.com to send email to live.com - there's nothing stopping you sending to a live.com address from a connection through gmail, so it sounds like you may have a conceptual issue. The Host, Username and Password properties are for the mail server that you send out through, not that you are sending mail to.
As I said, normally GoDaddy doesn't allow remote SMTP at all, so I'm very surprised if you've had it working without using a GoDaddy mail server, so I suspect you've had something else work, not what you think.
I can also see you've based your code on an obsolete example, so make sure you're running the latest PHPMailer.
Update:
I noticed something critical. The code does not call $mail->isSMTP();. This means that it's not using SMTP at all, it's using the default mail() function, and as such none of the SMTP config makes any difference at all. The message will be submitted to your local mail server, which will then relay through GoDaddy's server. Look in your mail server's log file to see what's happening, usually in /var/log/mail.log or similar.
Check your server ip on http://mxtoolbox.com/blacklists.aspx . I've noticed Microsoft is very picky about blacklisting. I've had this issue with a brand new I.P addresses that were acquired with an apparent bad rep. If your on godaddy on a shared account ip it's very likely either the ip or entire subnets are blocked by default.
I am trying to send out mails from my server without them getting into the junk folder when recieved in the other end. I did my research and found out that i should try out PHPMailer.
Now i've used 2 whole days crawling through the internet trying to come up with a solution to this problem. I want to send emails using googles free SMTP service. But cant get this to work at all.
All i get is the error msg : Could not connect to SMTP host
It also takes about 15 seconds before i actually get the error msg.
according to google this is how i should configure my settings:
http://mail.google.com/support/bin/answer.py?answer=13287
this is my code : (same as 10 other guidelines/tutorials i've found)
header('Content-Type: text/html; charset=utf-8');
require_once('../class.phpmailer.php');
require_once('../class.smtp.php');
$mail = new PHPMailer();
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->SMTPKeepAlive = true;
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->CharSet = 'utf-8';
$mail->Username = 'myadress#gmail.com'; // SMTP account username
$mail->Password = 'mypw';
$mail->SetFrom('myadress#gmail.com', 'My name');
$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->MsgHTML($body);
$mail->AddAddress("reciever#live.no", "Reciever Name");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
So this is clearly not working. Should i contanct my isp? Or should i try something else? I really need to be able to send out emails without them going straight to the junk folder...
best of regards,
alexander
I am trying to send out mails from my server without them getting into the junk folder when recieved in the other end. I did my research and found out that i should try out PHPMailer.
wrong. You've not done your research properly.
If they are getting as far as the remote end then there's nothing intrinsically wrong with your code. Using phpmailer() isn't going to help. Using a different SMTP service may help - but doesn't help you understand what's really going on here.
The question of how to get remote system to NOT treat your email as spam has been asked and answered numerous times here:
try reading some of the many good answers to these other posts
there is no definitive answer - there are just too many factors and even if you knew exactly what they were you couldn't account for them all
all you can do is make your emails look less like spam
this is all about the content of te email and the way the email server / DNS is configured
Your messages are marked as Spam by software like "Spamassassins", there are a lot of things to know, your message is rated from Spamassassin, according to this list for the last version: SpamAssassin Tests
Get a look and you will easily understand why your message is marked as spam.
The Higher is the score you reach, the higher is the probability to be marked as spam, try to send it in plain text.
If you can't connect to SMTP it may not be code related at all. In fact, from the sounds of it, your code is working as far as trying to do what its supposed to - just failing.
Can your server access smtp.gmail.com on port 465 through any firewall you may have on your machine or network? Is it allowed to at the other end? (Does Google allow this kind of access?)
You could try using PuTTy or similar to access the mail server directly, and type in some SMTP commands to see what messages you're getting back.
If you have a local mail server running, i'd try it with that and send yourself some messages and work from there.
Once you can actually SEND an email, as alluded to in the other answers - you can start worrying about having it accepted by servers and not treated as spam!
It sounds like your problem is not related to anti-spam processing, but rather an inability to actually connect to the Google SMTP server. That's where I'd focus at this point. Long delays in responses usually lead me to check out possible DNS issues as the first step in troubleshooting. Are you able to ping smtp.gmail.com from your server? If the hostname gets resolved by DNS and you get a response, then check whether outbound port 465 is being blocked at your firewall.
i am using phpmailer to send mails it is working with gmail but when it comes to yahoo giving the following errors
SMTP -> Error : Password not accepted from server : 530 access denied
SMTP -> Error : RSET failed
SMTP -> Error : Could not authenticate
i am using the working yahoo account.
Please give me a solution.
Thanks in advance.
Try to use Yahoo SMTP with normal email client (e.g. Thunderbird) and see if it works then? If it works - then problem is in phpmailer, if not - maybe IP somehow landed in some spam-blacklist and Yahoo is simply rejecting all mails from it?