require_once "mail/Swift.php";
require_once "mail/Swift/Connection/SMTP.php";
$email = $_POST['user@yahooorgmail.com'];
$swift =& new Swift(new Swift_Connection_SMTP("localhost", 25));
$message =& new Swift_Message("a html message", "text/html");
if ($swift->send($message, "$email", "admin@mysite.com"))
{
echo "An email has been sent with your link!";
}
else
{
echo "Message failed to send";
}
//It's polite to do this when you're finished
$swift->disconnect();
Does send() return true but the message never arrives, or is send() returning false? You may be being blocked as spam but I can't say without knowing the return value of the send() method
Well, I did appear on the Gmail SPAM folder (will follow those tips + how do I do multipart html + plain text emails?) but I still received the message.
rotwyla98 wrote:Well, I did appear on the Gmail SPAM folder (will follow those tips + how do I do multipart html + plain text emails?) but I still received the message.
Almost definitely sounds like a spam filter problem. How short is the message you're sending? HTML-only emails do suffer too (SA calculates the ratio of text to HTML and also the ratio of images to text, in addition to checking if the text actually says the same as the HTML. Short HTML messages, especially with images in will suffer.
When you checked the blacklist did you check the IP of your SMTP server or the IP of your web server?
require_once "mail/Swift.php";
require_once "mail/Swift/Connection/SMTP.php";
$swift =& new Swift(new Swift_Connection_SMTP("localhost", 25));
//Create a message
$message =& new Swift_Message("mysite.com - Free niche Guides");
//Add some "parts"
$message->attach(new Swift_Message_Part("Hey $name,/n Here is your link for the free guides!/n Please go to http://www.mysite.com/eval.php?e=$random_number to validate your email address and access your guides."));
$message->attach(new Swift_Message_Part("Hey $name,<br/>Here is your link for the free guides!<br/>Please click <a href=\"http://www.mysite.com/eval.php?e=$random_number\">HERE</a> to validate your email address and access your guides.<br/>", "text/html"));
if ($swift->send($message, "$email", "admin@mysite.com"))
What should I change/add?
Also, when I receive the email, the name shows up as "admin". Any way I can change that?
To be honest, as a human being reading what you just posted, it looks like spam. You use BLOCK CAPITALS which is a no-no (one of the many un-mentioned notes on that page I linked to), your message is one sentence long, linking to a remote website offering me something FREE...
I assume you're sending these to people who've asked for them but I suggest you think more tactfully about how you word the email. Try to bulk it out a bit for a start.
If I were a spam blocker I'd block that email personally
require_once "mail/Swift.php";
require_once "mail/Swift/Connection/SMTP.php";
$swift =& new Swift(new Swift_Connection_SMTP("localhost", 25));
$message =& new Swift_Message("MySite.com - Your Free Niche Guides", "Hey $name,/n
Here is your link for the free guides!\n\r Please go to http://www.mysite.com/eval.php?e=$random_number to validate your email address and access your guides.\n\r
\n\r
The above link is your personal link to verify your registration. You will then be automatically forwarded to the page with all of the guides you requested. All of these guides are written for free but cost lots of time and effort. Please be sure to vote for us (directions given on guides' page.\n\r
"));
if ($swift->send($message,new Swift_Address("$email", "$name"),new Swift_Address("admin@mysite.com", "Niche Guides"))){
echo "Thank you $name, <br>An email has been sent to $email with your link!";
}
else
{
echo "Message failed to send";
}
When I use the above code,nothing shows up on the next page + no error shows up. I inserted error_reporting (E_ALL); at the top but still no error, just a blank white page.
rotwyla98 wrote:I tried the code you gave me.. still didn't show any errors. Should I have safe_mode on or off?
Through a long process of commenting out code and replacing code, I found an extra parenthesis in my message
Send out the email....
the name shows up like I want it to on Gmail. Still SPAM on Yahoo.
I don't know what to do next =/
Email is not html.
I change the email address to a real one (mine) that is user@yahoo.com and its still SPAM.
Email isn't terribly short.
It could be that you're trying to send from a Yahoo! email address when Yahoo! knows you're not sending it *from* Yahoo.com. Does your domain accept emails? Does it work if you send from an account within your own domain?
When I send mail from Horde Mail on my server
==Message to yahoo is not delivered
==Message to gmail is delivered
I can accept emails.
Does that mean my servers SMTP address/domain is blacklisted?
EDIT: Did some more testing. Created a mail account on another one of my domains on the same IP, email still doesn't go through to Yahoo but does to Gmail.
Is it the same email you're trying to send? Maybe the email content is sniffed at by Yahoo. If Horde can't send to Yahoo and your other domain still doesn't work I'd be looking at your email wording. Words like "Hey <user>" and "FREE something" make emails look spammy.
I fixed up the message body.
I copied all the code to another server and it sent email successfully to gmail, yahoo, and hotmail.
Try on mine, doesn't work.
Would you like to PM me your IP? I may be able to help you figure out the problem and offer some guidance for correcting it. Sometimes the stupidest things can cause huge problems. No promises though