I have tried many mailing scripts in php,But my server always shows SMTP error.I am using PHP5.Any please help..
I think you are trying your code on local machine, try upload it to someserver than try ...
Related
I can't get user verification mail even after a success message. My file permission is 755. It show success message with or with out an smtp setting. I think problem arises after my server change. But php mail function is working when I tested in separate file on server.Any Idea about this problem.
Please install test email moodle plugin and test email using that plugin. it will show the error if email fail.
I have recently been unable to send out mails through php on localhost. I use PHPMailer and SwiftMailer in different parts of the application.
With SwiftMailer I get this:
Connection could not be established with host smtp.gmail.com [ #0]
With PHPMailer, the message is:
SMTP Error: Could not connect to SMTP host.
My settings on SwiftMailer look like this:
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
->setUsername(APP_GMAIL_EMAIL)
->setPassword(APP_GMAIL_PWD);
I have gone through several threads here at SO and elsewhere, and tried many 'fixes' but the error messages remain the same. Some "solutions" I've tried are:
Enable OpenSSL inphp.ini (It was previously off)
Change smtp.gmail.com to smtp.googlemail.com
Replace smtp.gmail.com with certain gmail IP addresses
Replace smtp.gmail.com with gethostbyname('smtp.gmail.com')
Add ->setSourceIp('0.0.0.0') to the instantiation code above, after setUsername and setPassword
This code was previously working, and I'm not sure what could have broken the function. As part of troubleshooting, I have just confirmed that a similar code on Linux shared hosting is emailing satisfactorily, suggesting that the problem is somehow from my environment. Thus, I even tried different sources of internet access, in case it's an ISP thing.
How can I crack this nut?
I have been able to overcome the problem, at least with SwiftMailer. The solution must have arisen after my PHP upgrade from 5.2.5 to 5.6, which is the version I have currently. The insight came from this page:
https://github.com/swiftmailer/swiftmailer/issues/544
If you are using PHP 5.6, the error does occur because of the "SSL
context options" used for the stream context in swiftmailer. IN PHP
5.6 verify_peer and verify_peer_name the default was set to TRUE, so PHP checks the SSL certificate. It is currently not possible to
disable it in swiftmailer using some options.
You could disable the SSL check by modifying the function
"_establishSocketConnection" in StreamBuffer.php. Add these lines
before stream_socket_client command:
$options['ssl']['verify_peer'] = FALSE;
$options['ssl']['verify_peer_name'] = FALSE;
It would be great if these options could be set without hacking the
code.
Thanks to https://stackoverflow.com/a/29448735/2554788 who first pointed me to the said post.
By the way, the path to StreamBuffer.php is:
\lib\classes\Swift\Transport
A word of warning though: this solution is based on hacking the code inside a class, and will probably fail, say, after upgrading SwiftMailer versions (in which case you'd need to go back and hack the code again).
Perhaps, more current versions of SwiftMailer have put their acts together in PHP 5.6 (I use SwiftMailer 5.1 currently). I intend to try an upgrade ASAP, hoping there has been an elegant fix for this issue.
i'm trying to create a contact form,with a code from a website,but when i open it with localhost,it give me an error:
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\programe\wamp\www\website\trimite.php on line 41
Well,this is the line 41:
mail($catre, $subiect, $mesaj, $headere);
It is anything wrong? Maybe it's because i need a database,or i dont know,im not really good at this.
Probably this is way too old, but since I have an easy fix (I guess) I will give it a shot:
If you only want to try the code (mail function) and see if the email is actually sent, in your dev environment, you can try to accomplish that with this small tool: http://www.toolheap.com/test-mail-server-tool/
I used it several times in the past when I had no proper smtp mail server configuration available and I had to test in a few seconds that my code was behaving properly.
I hope it helps.
I have been trying to setup email on my local machine. After some advice that it is a rather involved thing to set up, I started to look around for a solution to my problem and came across an app called mocksmtp. I have followed this tutorial to set it up. But i'm getting errors.
of
send-mail: warning: valid_hostname: invalid character 64(decimal): my.email#address.com
send-mail: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: my.email#address.com
Looking at this page I believe the problem is with /etc/postfix/main.cf
myhostname = my.email#address.com
but what value should I change the email address to to make this work? I have tried a few option but nothing has worked for me and in that post the only problem was a period at the end.
The tutorial is a valid and helpful page and would have worked perfectly had telnet localhost 1025 been enabled. Enabling telnet got it working. To do this telnet localhost 1025 worked for me
Looks like you're trying to enter an entire email in a parameter meant only for a host name. You should only have address.com, not my.email#address.com. It's not for a full email. You're setting this up as a server, to catch everything for a host, not just one particular email.
I want to make squirrelmail automatically forward every email that I receive without having to login and do it myself. I have have found 2 plugins from the site but none of them seem to be working (autoresponder, local_autorespond_forward)
I tried to do that by myself straight from the code but the messages are decoded.I am new to squirrelmail so I would like some help please. It is installed in a ubuntu server.
This is the problem i get with autoresponder
There was a problem connecting to your FTP server: "cannot log in to localhost". Please contact your support department.
Local_autorespond_forward plugin does not show any option when i go change its properties from the options.
Thanks