---
title: "Maila Hotmail med PHP:s mailfunktion?"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/103273-maila-hotmail-med-php-s-mailfunktion"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Grollen"
published: "2004-05-09T21:16:49.000Z"
updated: "2004-05-12T09:24:16.000Z"
replies: 6
views: 332
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/103273-maila-hotmail-med-php-s-mailfunktion"
---

# Maila Hotmail med PHP:s mailfunktion?

## #1 — Grollen, 2004-05-09T21:16Z

Tjena!

Jag håller på med ett projekt, men får inte våran mailfunktion att fungera till hotmailaddresser, vare sig de skickas direkt eller forwardas från en annan adress. De fungerar utmärkt till de flesta mailadresser förutom just hotmailadresser. Någon som har en idé om varför? Så här ser mailfunktionen ut:

```php
 public static function sendInviteEmail($email, $projectID, $activationCode, $rank) {
        $name = "ourProject";
        $ourEmail = "None@ourProject.com";
        $yourName = "Ost";
        $to = " " . $yourName . "< " . $email . ">";
        $subject = "" . $name . ": You are invited to join a project";
        $message = "
    	<html>
    	<head>
    	<title> Invitation to join a project </title>
    	<body> You are invited to join our project with activation code ". $activationcode.". Bla bla bla.
    	</body>
    	</html>
    	";
        $headers = "From: Our project <" . $ourEmail . ">\n";         
$headers .= "Subject: $subject\r \n";
        $headers .= "MIME-Version: 1.0\r \n";
        $headers .= "Content-Type: text/HTML; charset=\"iso-8859-1\"\r \n";
        $headers .= "Content-Transfer-Encoding: 7bit\r\n";
        $headers .= "Reply-To: Project Planner <" . $ourEmail . ">\n";
        $headers .= "X-Priority: 3\r \n";
        $headers .= "X-MSMail-Priority: Normal\r \n";
        mail($email, $subject, $message, $headers);
    }
```

 

Tacksam för svar!

Permalänk: https://www.webforum.nu/p/103273

## #2 — lunne82, 2004-05-09T22:28Z

Du hittar detta svar i [denna tråden](http://www.webforum.nu/showthread.php?s=&threadid=100968&forumid=23) av Qonos.

> I have found that putting "\\r\\n\\r\\n" after the last header (creates a blank line), and ensuring no spaces in the from header solved the problems I was having with hotmail accepting email from my mail() script.

<http://www.php.net/mail>

Permalänk: https://www.webforum.nu/p/1343765

## #3 — Grollen, 2004-05-10T21:43Z

Detta fungerar ju tyvärr inte heller... :( Någon som har något annat förslag?

Permalänk: https://www.webforum.nu/p/1344163

## #4 — monAmour, 2004-05-11T06:00Z

Kolla om det är något i headern som sumpar, skicka ett mail med mail() utan headers.

Permalänk: https://www.webforum.nu/p/1344238

## #5 — Grollen, 2004-05-11T07:21Z

Det fungerar tyvärr inte utan headers heller.

Permalänk: https://www.webforum.nu/p/1344259

## #6 — Matte, 2004-05-11T07:28Z

Jag ser du använder '\\r \\n', men radbrytningstecken för Windows är '\\r\\n' utan mellanslag. 
Testa med att ta bort detta mellanslag.

Permalänk: https://www.webforum.nu/p/1344262

## #7 — fourt, 2004-05-12T09:24Z

Följande kanske kan lösa problemet. 

$from = "frånepost@domän.com";
mail($email, $subject, $message, $headers, "-f $from");

Permalänk: https://www.webforum.nu/p/1344878

---

Tråden på webben: https://www.webforum.nu/amne/php/103273-maila-hotmail-med-php-s-mailfunktion
