- ベストアンサー
mailコマンドで上手くいかない
こんにちは。よろしくお願いします。 http://www.freewebmasterhelp.com/tutorials/php/5 こちらのインストラクションに従ってやっていたのですが行き詰まっています。 <?php $to = "mmmm@mmm.mmm"; $subject = "PHP Is Great"; $body = "PHP is one of the best scripting languages around"; $headers = "From: webmaster@66.124.58.0\n"; if(mail($to,$subject,$body,$headers)) { echo "An e-mail was sent to $to with the subject: $subject"; } else { echo "There was a problem sending the mail. Check your code and make sure that the e-mail address $to is valid"; } ?> というスクリプトをemail.phpで保存し、ブラウザから開きました。以下が表示されます。 >Warning: Failed to Connect in D:\FoxServ\www\test\email.php on line 6 >There was a problem sending the mail. Check your code and make sure that the e-mail address mmmm@mmm.mmm is valid 二行目は思惑通りですが、一行目のエラーがheaderの入力がまずいのかなーと思っているのですが、なぜなのか解りません。 ちなみにメールアドレスをきちんと打ち込んでも一行目のエラーは変わらないです。 Apache 2.0 / PHP Version 4.2.2 / Windows XP SP1 どうぞよろしくお願いします。
- みんなの回答 (8)
- 専門家の回答
質問者が選んだベストアンサー
その他の回答 (7)
- xjd
- ベストアンサー率63% (1021/1612)
- Marionette
- ベストアンサー率56% (42/74)
- Marionette
- ベストアンサー率56% (42/74)
- osamuy
- ベストアンサー率42% (1231/2878)
- xjd
- ベストアンサー率63% (1021/1612)
- osamuy
- ベストアンサー率42% (1231/2878)
- xjd
- ベストアンサー率63% (1021/1612)
関連するQ&A
- PHP の mail( ) 関数について
お世話になります。 PHPのmail( )関数の使い方を練習しようと思い、以下に添付した簡単なスクリプトを試してみましたが、エラーが出ました。 スクリプト: <?php $address = 'my_address@yahoo.ca'; $subject = 'test mail'; $message = "Hello, I'm sending you an e-mail message.\r\n If you can read this. please let me know.\r\n"; $headers[] = "From: from@company.jp"; $headers[] = "Cc:sales@company.com"; $headers[] = "Content-type: text/html; charset=UTF-8"; $headers = implode("\r\n", $headers); $result = mail($address, $subject, $message, $headers, '-fmy_address@yahoo.ca'); if($result){ echo "message was sent<BR>"; } エラーメッセージ: 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 C:\xampp\htdocs\PHP-practice\email.php on line 9 ちなみに、エラーメッセージにある hp.ini の 関連個所は次のようになっています。 [mail function] ; For Win32 only. ; https://php.net/smtp SMTP=localhost ; https://php.net/smtp-port smtp_port=25 詳しい方がいらっしゃいましたら、自分のスクリプトの問題点と解決方法について、何かヒントでも頂けると有り難いです。 よろしくお願いいたします。
- ベストアンサー
- PHP
- メールフォームから送信すると文字化けします^^;
海外のHPのテンプレサイトにてダウンロードしたテンプレート内のメールフォームで送信すると文字化けしてしまいます^^; 下記がsendmail.php内の中身なのですが、何が足りないでしょうか?^^; ご教授よろしくお願いします。 http://www.premiumfreebies.eu/previews/ProFolio/ <? //This php file receives the post vars of the contact page and sends it to a email address //Settings $email = 'メールアドレス'; $subject = '[NAME] HP form mail '; $name = $_POST['name']; $from = $_POST['email']; $message = $_POST['message']; mb_language("ja"); mb_internal_encoding("UTF-8"); //Set the headers and send the mail $subject = str_replace('[NAME]', $name, $subject); $headers = 'From: '.$name.' <'.$from.'>'; mail($email, $subject, $message, $headers); ?>
- ベストアンサー
- PHP
- メールが戻ってきます。
アメリカのあるお店にメールを送りました。下記のようなメッセージで戻ってきます。 添付で自分の送った文章がついてきます。 どうしたら送ることができますか? 私はyahooを使っています。 Your message Subject: TO: Customer Service was not delivered to:******@mail.calltech.com because: Router: ******@yahoo.co.jp is restricted from sending mail through server SMTP/店名 どなたか分かりましたら教えて下さい。
- 締切済み
- その他(メールサービス・ソフト)
- PHPのmail関数で送信者を設定できません
// 表題 $subject = $_POST['news_title']; // 本文 $message = ' <html> <head> <title>'.$_POST['news_title'].'</title> </head> <body> '.$_POST['textarea_id'].' </body> </html> '; // HTML メールを送信するには Content-type ヘッダが必須 $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; // 追加のヘッダ $headers .= 'To: '.$user_name.'<'.$email.'>'. "\r\n"; //$headers .= $_POST['news_title'] . "\r\n"; $headers .= 'From: 姓名 <myname@mymail.com>' . "\r\n"; // 送信する if(mail($to, $subject, $message, $headers)){$mes .= $email.'にメールを送信しました。 ';}else{$mes .= $email.'にメールを送信する際にエラーが発生しました。 ';} (後略) のようなコードになっていますが。$headersでFrom:を設定したのに、受信するメールには、送信者として、なになに@box450.bluehost.comが表示されます。どうやって正しく送信者を設定できるのでしょうか 因みにapacheのhttpd.confやPHPのphp.iniを変更できません。 わかる方がいらっしゃいましたら、ご回答をよろしくお願いします。
- ベストアンサー
- PHP
- PCから携帯にメールすると
PCから携帯にメールすると エラーになってしまいます。 その内容が読めないので、誰か 訳してくれませんか?? This Message was undeliverable due to the following reason: Your message was not delivered because the destination computer was not found. Carefully check that it was spelled correctly and try sending it again if there were any mistakes. It is also possible that a network problem caused this situation, so if you are sure the address is correct you might want to try to send it again. If the problem continues, contact your friendly system administrator. Host dokomo.ne.jp not found. The following recipients did not receive this message:
- 締切済み
- アンケート
- PHPとFALSH連携メール
mail.fla と flash_mail.php に下記のように記述してます。 flash_mail.php で、var_dump() したら、すべてNULL になります。 .fla ファイルのシンタックスは通ってるのですが、 Action Scriptのどこかが間違っていると思います。 どこが間違っているのかお教え願いますでしょうか。 【mail.fla】 1フレーム目(キーフレーム)に書きを記述 LV1 = new LoadVars(); LV1.shimei = shimei; LV1.email = email; LV1.subject = subject; LV1.honbun = honbun; LV1.sendAndLoad("flash_mail.php", LV1, "POST"); submit_btn.onRelease = function(){ getURL("flash_mail.php"); } --------------------------------------------------------------------------- 【flash_mail.php】 <?php $shimei = $_POST['shimei']; $email = $_POST['email']; $subject = $_POST['subject']; $honbun = $_POST['honbun']; var_dump($shimei); var_dump($email); var_dump($subject); // 送信者へメール $to = $email; $from = "~"; $subject = mb_convert_encoding($subject, "utf-8", "auto"); // utf-8にエンコード $honbun = mb_convert_encoding($honbun, "utf-8", "auto"); mb_internal_encoding("UTF-8"); mb_send_mail($to, $subject, $honbun, $from); echo 'test complete!'; ?>
- ベストアンサー
- PHP
- メールフォームの差出人を任意のアドレス表示に
PHPでメールフォーム作ったのですが、差出人のアドレスを任意のものにしたいのです。 PHPは先月から始めた超初心者です。 いろいろな質問掲示板を参照にやっては見るのですが、出来ません。 //メール送信部分 mb_language("ja"); mb_internal_encoding("Shift-JIS"); $mailfr = "From:xxxx@oooo.oo"; $to = "aaa@dd.bn"; $subject = "タイトル"; $thanks = "コメント"; $headers = mb_convert_encoding($thanks, "SJIS","EUC-JP"); $message .= mb_convert_encoding($chuumonnaiyou, "SJIS","EUC-JP"); $message .= "\n\n"; $subject2 = "タイトル"; $thanks2 = "お礼メッセージ"; $headers2 = mb_convert_encoding($thanks2, "SJIS","EUC-JP"); $message .= "\n\n"; $message .= $copyright; mail($to, $subject, $message, $headers, $mailfr); ←上記に設定したメールアドレスに届く内容。 mail($email1, $subject2, $message, $headers2, $mailfr); ←フォームを利用して送ってくれた方への内容。 これも合っているのかわからないのですが、メールを送信も出来るし、受信も出来ています。 文字化けを起こしていたので、現在の型になりました。 (文字化けは、こちらの掲示板を利用して何とか解決しました。) もしかして、すごく簡単な質問なのかも知れませんが、調べては試しての繰り返しをしているのですがなかなか出来なくて困っています。 ぜひ、ご教授お願いします。
- ベストアンサー
- PHP
- GOOメールがエラーになる。
こんにちわ。 前にも質問したんですが、全然解決できなかったのでもう一度質問 させていただきました。 AさんがGOOメールを使って私のOutlookに送信すると 下記の英文エラーとなってAさんに返ってくるらしく、 私のOutlookに送信できないそうです。 これはどうしてでしょうか?すごい困ってます。 対処方法を教えてくださいm(__)m This Message was undeliverable due to the following reason: Your message was not delivered because the destination computer was not found. Carefully check that it was spelled correctly and try sending it again if there were any mistakes. It is also possible that a network problem caused this situation, so if you are sure the address is correct you might want to try to send it again. If the problem continues, contact your friendly system administrator.
- ベストアンサー
- その他(メールサービス・ソフト)
- HTMLメールを送信するには
PHPからHTMLメールを送信する際の追加ヘッダーに書くべき内容について教えてください。 $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; multipart/alternative; charset=Shift_JIS\r\n"; mail($to, $subject, $message, $headers); として発信してますが 一部の受信側でTXTに化けてしまいます。 どなたか、HTMLメールの追加ヘッダーの書き方を教えていただきたいのですがよろしくお願いいたします。 5/11 usagi_024
- 締切済み
- PHP
- PHPから携帯へメール送信
いつもお世話になっております。 PHPから携帯電話へ"絵文字付き"でメールを送るプログラムを作成している のですが、『base64_encode』等を使用して絵文字の表示までは行う事がで きました。 ですが、本文が途中で途切れてしまうのです・・・。 PHP側は、 $to = mb_convert_encoding(mb_decode_mimeheader($structure->headers['from']), 'SJIS', 'ISO-2022-JP'); $subject = mb_convert_encoding(mb_decode_mimeheader($structure->headers['subject']), 'SJIS', 'ISO-2022-JP'); (省略) ・ ・ $body = $structure->body; $body = preg_replace('/\s*>\s.*/', '', $body); $body = mb_convert_encoding($body, 'SJIS', 'ISO-2022-JP'); //---------------------------------- // base64_encode //---------------------------------- $subject = "=?shift_jis?B?" . base64_encode($subject) . "?="; $body = base64_encode($body); //---------------------------------- // ヘッダを作成 //---------------------------------- $headers = "From: test@mail.com\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: text/plain; charset=Shift-JIS\n"; $headers .= "Content-Transfer-Encoding: base64"; //---------------------------------- // メール送信 //---------------------------------- $res = mail($to, $subject, $body, $headers); ・ ・ (省略) 上記のように記述しています。 メールは送れます。絵文字も表示されます。ですが、本文が途中で途切れ てしまいます。 どなたかご教授をお願い致します。
- ベストアンサー
- PHP
- DCP-J926Nの初期設定において、印刷品質が低い問題が発生しています。特に色がほとんど出ない場合や、左上の黒丸が出力されない場合があります。本記事では、これらの問題の原因と解決方法について詳しく解説します。
- DCP-J926Nの初期設定で印刷品質に問題が発生しており、特に色の出力が不十分な状態です。また、左上の黒丸が印刷されないというトラブルも報告されています。本記事では、これらの問題に対する対処方法を紹介します。
- DCP-J926Nの初期設定において、印刷品質に関する問題が発生しています。特に色がほとんど出力されず、補正が必要な場合や、左上の黒丸が印刷されない場合があります。本記事では、これらの問題に対する解決策をご紹介します。
お礼
う~ん。結局プロバイダのSmtpサーバは上手くいきませんでした。 もう時間がかなり経ってしまいましたし、最後までお付き合いいただけなかったのが少し残念ですが、締め切らせていただきますね。 感謝しています。
補足
たびたびありがとうございます。 なんか不思議な事が起こりました。 メールサーバを立ち上げている時は [mail function] ; For Win32 only. SMTP = smtp.####.####.com (プロバイダのSMTPサーバ) ; For Win32 only. sendmail_from = ####@#####.net (プロバイダから供給されるメールアドレス) ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ;sendmail_path = で送信できました。サーバをexitしてもう一度同じ事(php.iniは上記のまま)をしたらエラーが出ました。 何なんでしょうか??xidさんはメールサーバ入れてますか? (これから寝ます)