php


PHPMailer with SMTP details


I would like to send mail from my php form. Initially I had used php mail function and it was working fine. But I recently shifted my server from windows to Linux in which SMTP is mandatory. I am not given access to php.ini file. Hence I am using phpMailer function. But when I use phpMailer, it gives me the following error
Invalid address: (punyEncode) abc-domain Mailer Error: Invalid
address: (punyEncode) abc-domain.
My username is not my mail address i.e., abc#domain.com but it is abc-domain. Here is my code. I have PHPMailer files in a folder called PHPMailer.
<?php
require('PHPMailer/PHPMailerAutoload.php');
$mail = new PHPMailer;
$mail->CharSet = "UTF-8";
$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Host = "mail.abc.com";
$mail->SMTPAuth = true;
$mail->Username = "abc-domain";
$mail->Password = "abc123";
$mail->Port = 25;
$mail->From = "abc-domain";
$mail->FromName = "Webmaster-Domain";
$mail->addAddress("xyz#domain.com", "xyz");
$mail->isHTML(true);
$mail->Subject = "Subject Text";
$mail->Body = '<h1 style="font-family: Arial;">HTML Text</h1>';
if(!$mail->send())
{
$mail->SMTPDebug = true;
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo $success;
}
?>
Is there a way to setup SMTP details through .htaccess?
The problem is here
$mail->From = "abc-domain";
It should be a valid email, even if you user isn't (which is ok, because you only need it here $mail->Username)

Related Links

php mail function is not working on server
Increasing the email sending speed of phplist
Getting duplicate entries in row with primary key
Port opened for Curl from ssh but not from PHP
Convert command of CRUL in PHP for Alchemy API
How can I use a web service in my wordpress website?
php convert date format Manual dd/mm/yyyy [duplicate]
how to fetch data in multiple div from database in codeigniter
In codeigniter controller fuction get all control name as column name
Laravel Query: BadMethodCallException in Builder.php line 2258:
Displaying fields with values only with foreach limit
Where to install PECL extension while transferring the files from localhost to remote server
How to rewriting .htaccess rule with multiple optional values to multiple pages [duplicate]
Is is possible to use array_map in this case instead of foreach?
Call another function within a function and pass data
I have an array and I put them in table, I need to change background color of table [closed]

Categories

HOME
entity-framework
powerbi
matrix
weblogic12c
functional-programming
cucumber
jms
systemd
dafny
nsis
google-sheets-query
google-search-console
polymer-2.x
yahoo
siesta
solution
smooks
squirrel-sql
trace32
jpa-2.0
distributed-computing
global-variables
reselect
web-deployment
gmp
spring-shell
workday
liferay-6.2
list-comprehension
oracleforms
python-imageio
math.js
php-5.3
locks
winsock
series
osx-lion
appcode
bootstrap-sass
db2-luw
amazon-kms
netstat
redgate
jslint
installanywhere
android-alarms
data-uri
destroy
common-table-expression
md5-file
renderman
mura
apache-modules
nitrousio
dcount
nvda
zynq
cdo.message
apache-pig-grunt
codecharge
vaadin4spring
flush
flask-security
myfaces
odesk
bayesglm
blank-line
gluon-desktop
netdatacontractserializer
mobilefirst-server
textscan
web-api
tree-structure
mathematical-expressions
cout
tabris
treeline
jini
preorder
jomsocial
codahale-metrics
lru
ui-design
contextswitchdeadlock
xmlwriter
dojo-1.9
struts2-json-plugin
popup-blocker
navigationcontroller
memory-pool
multidrop-bus
cewolf
airprint
multiple-users
odac
icicles
parentid

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App